百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

VirtualDesktop

> 编程语言
开源

用于 Windows 11 上的虚拟桌面 API 的 C# 封装。

692 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Windows 11 上的虚拟桌面 API 的 C# 封装。

VirtualDesktop

VirtualDesktop is C# wrapper for IVirtualDesktopManager on Windows 11 (and 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).
  • Pin any window or application; will be display on all desktops.
  • Notification for switching, deletion, renaming, etc.
  • Change the wallpaper for each desktop.

Sample app

samples/VirtualDesktop.Showcase

Requirements

net5.0-windows10.0.19041.0
  • .NET 5 or 6
  • Windows 10 build 19041 (20H1) or later

Installation

Install NuGet package(s).

PM> Install-Package VirtualDesktop
  • VirtualDesktop - Core classes for VirtualDesktop.
  • VirtualDesktop.WPF - Provides extension methods for WPF Window class.
  • VirtualDesktop.WinForms - Provides extension methods for Form class.

How to use

Preparation

Because of the dependency on C#/WinRT (repo), the target framework must be set to net5.0-windows10.0.19041.0 or later.

net5.0-windows10.0.19041.0
net6.0-windows10.0.19041.0

If it doesn't work, try creating an app.manifest file and optimize to work on Windows 10.


    
	    
	    
    

The namespace to use is WindowsDesktop.

using WindowsDesktop;

Get instance of VirtualDesktop class

// Get all virtual desktops
var desktops = VirtualDesktop.GetDesktops();

// Get Virtual Desktop for specific window
var desktop = VirtualDesktop.FromHwnd(hwnd);

// Get the left/right desktop
var left  = desktop.GetLeft();
var right = desktop.GetRight();

Manage virtual desktops

// Create new
var desktop = VirtualDesktop.Create();

// Remove
desktop.Remove();

// Switch
desktop.GetLeft().Switch();

Subscribe virtual desktop events

// Notification of desktop switching
VirtualDesktop.CurrentChanged += (_, args) => Console.WriteLine($"Switched: {args.NewDesktop.Name}");

// Notification of desktop creating
VirtualDesktop.Created += (_, desktop) => desktop.Switch();

for WPF window

// Need to install 'VirtualDesktop.WPF' package

// Check whether a window is on the current desktop.
var isCurrent = window.IsCurrentVirtualDesktop();

// Get Virtual Desktop for WPF window
var desktop = window.GetCurrentDesktop();

// Move window to specific Virtual Desktop
window.MoveToDesktop(desktop);

// Pin window
window.Pin()

See also:

  • samples/README.md

License

This library is under the MIT License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#csharpdotnetvirtualdesktopwindows10

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言