Skip to content

Repository files navigation

VirtualDesktop

VirtualDesktop is C# wrapper for IVirtualDesktopManager on Windows 10.

Features

  • Switch, add, and remove a Virtual Desktop.
  • Move the window in the same process to any Virtual Desktop.
  • Move the window of another process to any Virtual Desktop (Support in version 2.0 or later).

Installation

Install NuGet package(s).

PM>Install-Package VirtualDesktop

How to use

Preparation:

<!-- Please create application manifest file and run without debugging. -->
<compatibilityxmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOSId="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
usingWindowsDesktop;

Get instance of VirtualDesktop:

// Get all Virtual Desktopsvardesktops=VirtualDesktop.GetDesktops();// Get Virtual Desktop for specific windowvardesktop=VirtualDesktop.FromHwnd(hwnd);// Get the left/right desktopvarleft=desktop.GetLeft();varright=desktop.GetRight();

Manage Virtual Desktops:

// Create newvardesktop=VirtualDesktop.Create();// Removedesktop.Remove();// Switchdesktop.Switch();

for WPF window

// Need to install 'VirtualDesktop.WPF' package// Check whether a window is on the current desktop.varisCurrent=window.IsCurrentVirtualDesktop();// Get Virtual Desktop for WPF windowvardesktop=window.GetCurrentDesktop();// Move window to specific Virtual Desktopwindow.MoveToDesktop(desktop);

See also:

License

This library is under the MIT License.

About

Wrapper for API to Virtual Desktop on Windows 10.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages