{"id":14976701,"url":"https://github.com/grabacr07/virtualdesktop","last_synced_at":"2025-10-04T08:32:16.015Z","repository":{"id":2957156,"uuid":"41444756","full_name":"Grabacr07/VirtualDesktop","owner":"Grabacr07","description":"C# wrapper for the Virtual Desktop API on Windows 11.","archived":false,"fork":false,"pushed_at":"2024-09-03T22:08:11.000Z","size":263,"stargazers_count":669,"open_issues_count":39,"forks_count":136,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-15T07:05:57.050Z","etag":null,"topics":["csharp","dotnet","virtualdesktop","windows10","windows11"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Grabacr07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-26T19:10:32.000Z","updated_at":"2025-05-13T15:49:24.000Z","dependencies_parsed_at":"2024-09-18T20:03:26.525Z","dependency_job_id":null,"html_url":"https://github.com/Grabacr07/VirtualDesktop","commit_stats":{"total_commits":124,"total_committers":9,"mean_commits":"13.777777777777779","dds":0.2016129032258065,"last_synced_commit":"a6c69e420307e0717f296501c1e7595977e27b6b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grabacr07%2FVirtualDesktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grabacr07%2FVirtualDesktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grabacr07%2FVirtualDesktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Grabacr07%2FVirtualDesktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Grabacr07","download_url":"https://codeload.github.com/Grabacr07/VirtualDesktop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292042,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","virtualdesktop","windows10","windows11"],"created_at":"2024-09-24T13:54:17.176Z","updated_at":"2025-10-04T08:32:10.979Z","avatar_url":"https://github.com/Grabacr07.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VirtualDesktop\r\n\r\nVirtualDesktop is C# wrapper for [IVirtualDesktopManager](https://msdn.microsoft.com/en-us/library/windows/desktop/mt186440%28v%3Dvs.85%29.aspx) on Windows 11 (and Windows 10).\r\n\r\n[![Build](https://github.com/Grabacr07/VirtualDesktop/actions/workflows/build.yml/badge.svg)](https://github.com/Grabacr07/VirtualDesktop/actions/workflows/build.yml)\r\n[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/VirtualDesktop)](https://www.nuget.org/packages/VirtualDesktop/)\r\n[![License](https://img.shields.io/github/license/Grabacr07/VirtualDesktop)](LICENSE)\r\n\r\n\r\n## Features\r\n\r\n* Switch, add, and remove a virtual desktop.\r\n* Move the window in the same process to any virtual desktop.\r\n* Move the window of another process to any virtual desktop (Support in version 2.0 or later).\r\n* Pin any window or application; will be display on all desktops.\r\n* Notification for switching, deletion, renaming, etc.\r\n* Change the wallpaper for each desktop.\r\n\r\n\r\n### Sample app\r\n\r\n![](https://user-images.githubusercontent.com/1779073/152605684-2d872356-1882-4bfd-821d-d4211ccac069.gif)\r\n[samples/VirtualDesktop.Showcase](samples/VirtualDesktop.Showcase)\r\n\r\n\r\n## Requirements\r\n\r\n```xml\r\n\u003cTargetFramework\u003enet5.0-windows10.0.19041.0\u003c/TargetFramework\u003e\r\n```\r\n* .NET 5 or 6\r\n* Windows 10 build 19041 (20H1) or later\r\n\r\n\r\n## Installation\r\n\r\nInstall NuGet package(s).\r\n\r\n```powershell\r\nPM\u003e Install-Package VirtualDesktop\r\n```\r\n\r\n* [VirtualDesktop](https://www.nuget.org/packages/VirtualDesktop/) - Core classes for VirtualDesktop.\r\n* [VirtualDesktop.WPF](https://www.nuget.org/packages/VirtualDesktop.WPF/) - Provides extension methods for WPF [Window class](https://msdn.microsoft.com/en-us/library/system.windows.window(v=vs.110).aspx).\r\n* [VirtualDesktop.WinForms](https://www.nuget.org/packages/VirtualDesktop.WinForms/) - Provides extension methods for [Form class](https://msdn.microsoft.com/en-us/library/system.windows.forms.form(v=vs.110).aspx).\r\n\r\n\r\n## How to use\r\n\r\n### Preparation\r\nBecause of the dependency on [C#/WinRT](https://aka.ms/cswinrt) ([repo](https://github.com/microsoft/CsWinRT)), the target framework must be set to `net5.0-windows10.0.19041.0` or later.\r\n```xml\r\n\u003cTargetFramework\u003enet5.0-windows10.0.19041.0\u003c/TargetFramework\u003e\r\n```\r\n```xml\r\n\u003cTargetFramework\u003enet6.0-windows10.0.19041.0\u003c/TargetFramework\u003e\r\n```\r\n\r\nIf it doesn't work, try creating an `app.manifest` file and optimize to work on Windows 10.\r\n```xml\r\n\u003ccompatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"\u003e\r\n    \u003capplication\u003e\r\n\t    \u003c!-- Windows 10 / 11--\u003e\r\n\t    \u003csupportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" /\u003e\r\n    \u003c/application\u003e\r\n\u003c/compatibility\u003e\r\n```\r\n\r\nThe namespace to use is `WindowsDesktop`.\r\n```csharp\r\nusing WindowsDesktop;\r\n```\r\n\r\n### Get instance of VirtualDesktop class\r\n```csharp \r\n// Get all virtual desktops\r\nvar desktops = VirtualDesktop.GetDesktops();\r\n\r\n// Get Virtual Desktop for specific window\r\nvar desktop = VirtualDesktop.FromHwnd(hwnd);\r\n\r\n// Get the left/right desktop\r\nvar left  = desktop.GetLeft();\r\nvar right = desktop.GetRight();\r\n```\r\n\r\n### Manage virtual desktops\r\n```csharp\r\n// Create new\r\nvar desktop = VirtualDesktop.Create();\r\n\r\n// Remove\r\ndesktop.Remove();\r\n\r\n// Switch\r\ndesktop.GetLeft().Switch();\r\n```\r\n\r\n### Subscribe virtual desktop events\r\n```csharp\r\n// Notification of desktop switching\r\nVirtualDesktop.CurrentChanged += (_, args) =\u003e Console.WriteLine($\"Switched: {args.NewDesktop.Name}\");\r\n\r\n// Notification of desktop creating\r\nVirtualDesktop.Created += (_, desktop) =\u003e desktop.Switch();\r\n```\r\n\r\n### for WPF window\r\n```csharp\r\n// Need to install 'VirtualDesktop.WPF' package\r\n\r\n// Check whether a window is on the current desktop.\r\nvar isCurrent = window.IsCurrentVirtualDesktop();\r\n\r\n// Get Virtual Desktop for WPF window\r\nvar desktop = window.GetCurrentDesktop();\r\n\r\n// Move window to specific Virtual Desktop\r\nwindow.MoveToDesktop(desktop);\r\n\r\n// Pin window\r\nwindow.Pin()\r\n```\r\n\r\n### See also:\r\n* [samples/README.md](samples/README.md)\r\n\r\n\r\n## License\r\n\r\nThis library is under [the MIT License](https://github.com/Grabacr07/VirtualDesktop/blob/master/LICENSE).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrabacr07%2Fvirtualdesktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrabacr07%2Fvirtualdesktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrabacr07%2Fvirtualdesktop/lists"}