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

MaximizeToVirtualDesktop

> 编程语言
开源

Windows 11 中的 macOS 绿色按钮行为 — 将任何窗口最大化到自己的虚拟桌面

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

工具介绍

Windows 11 中的 macOS 绿色按钮行为 — 将任何窗口最大化到自己的虚拟桌面

MaximizeToVirtualDesktop

Bring macOS's green-button "maximize to full-screen virtual desktop" behavior to Windows 11.

When triggered, the foreground window is moved to a brand-new virtual desktop and maximized. Closing, un-maximizing, or toggling the hotkey again restores everything — the window returns to its original desktop and size, and the temporary desktop is removed.

Usage

Trigger How
Hotkey Ctrl + Alt + Shift + X — toggles the foreground window
Shift + Click Hold Shift and click a window's maximize button

The app runs in the system tray. Right-click the tray icon for options:

  • Restore All — brings all windows back and removes temp desktops
  • How to Use — shows usage instructions
  • Settings — configure hotkeys and whether switch popups are shown
  • Check for Updates — checks for new releases on GitHub
  • Exit — restores all windows, then exits

How It Works

  1. Maximize — creates a new virtual desktop, moves the window there, switches to it, and maximizes the window. The desktop is named [MVD] ProcessName so you can identify it in Task View.
  2. Auto-restore on un-maximize — if you restore/un-maximize a tracked window, it's automatically sent back to its original desktop and the temp desktop is cleaned up.
  3. Auto-restore on close — closing a tracked window triggers the same cleanup.
  4. Toggle — pressing the hotkey on an already-tracked window restores it.
  5. Crash recovery — if the app is killed or crashes, orphaned desktops are automatically cleaned up on next launch.

Requirements

  • Windows 11 (any version — 21H2 through 24H2+)
  • Self-contained — no .NET installation required

The app auto-detects your Windows build and selects the correct COM vtable layout. If a future Windows update breaks things, the app enters degraded mode and checks for updates automatically.

Shift+Click Compatibility

Shift+Click works wherever Windows 11 Snap Layouts works — apps that correctly handle WM_NCHITTEST and return HTMAXBUTTON. This includes:

App Works?
Notepad, Explorer, traditional Win32 ✅
Windows Terminal (WinUI) ✅
VS Code (Electron 13+) ✅
Visual Studio ✅
Apps with fully custom title bars ❌ (use hotkey)

The hotkey always works, regardless of the window type.

Building

bash
dotnet build

Single-file publish

bash
dotnet publish -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true

Architecture

…

Zero NuGet dependencies. COM interop declarations are vendored from MScholtes/VirtualDesktop (MIT license, actively maintained). The app ships two vtable layouts (pre-24H2 and 24H2+) and auto-selects the correct one with a smoke test fallback.

Design Principles

  1. Reliable over featureful — every code path handles failure. No crashes, no orphaned desktops, no stuck windows. If something goes wrong, roll back to the state before we touched anything.
  2. Tight — one project, zero packages, 9 files. Each file has one job.
  3. Clean — IDisposable on every native resource. No fire-and-forget. All WinEvent callbacks marshal to the UI thread.

Known Limitations

  • Elevated windows — cannot move windows running as Administrator from a non-elevated instance.
  • App crash — if the app crashes, temporary desktops are cleaned up automatically on next launch. They're prefixed with [MVD] in Task View for easy manual identification.

The Virtual Desktop GUID Problem

Microsoft's Virtual Desktop feature has a proper, documented COM interface — IVirtualDesktopManager — but it can only tell you which desktop a window is on and move a window you own between desktops. The actually useful operations — creating desktops, switching desktops, moving any window, naming desktops — all live behind undocumented COM interfaces like IVirtualDesktopManagerInternal and IVirtualDesktop.

The problem? Microsoft changes the interface GUIDs with nearly every major Windows update. Not the methods. Not the signatures. Just the GUIDs. This means every app that uses virtual desktop automation — this one, Peach, FancyWM, and dozens of others — breaks silently 2-3 times a year and has to scramble to update hardcoded GUIDs.

This is the single biggest fragility in this app. When it breaks, the app shows an error dialog on startup saying "Failed to initialize Virtual Desktop COM interface." The fix is straightforward but shouldn't be necessary:

How to update the GUIDs

  1. Check MScholtes/VirtualDesktop — Markus Scholtes maintains per-build interface files (e.g., VirtualDesktop11-24H2.cs) and typically updates within days of a new Windows build. Huge thanks to him for doing this thankless work for the entire community.
  2. If it's a vtable change (new/removed methods, same GUIDs), add a new adapter class in DesktopManagerAdapter.cs and a new COM interface in VirtualDesktopCom.cs.
  3. If it's a GUID change, update the GUIDs on the affected interfaces.
  4. The fragile GUIDs are on these interfaces:
Interface What it does Stable?
IVirtualDesktopManager Check/move owned windows ✅ Documented, stable since Win10
IServiceProvider10 Standard COM service lookup ✅ Stable
IObjectArray Standard COM collection ✅ Stable
IVirtualDesktop Desktop identity, name, wallpaper ⚠️ Breaks with Windows updates
IVirtualDesktopManagerInternal Create, switch, move, remove desktops ⚠️ Breaks with Windows updates
IApplicationView Window view for cross-process moves ⚠️ Breaks with Windows updates
IApplicationViewCollection Get views by window handle ⚠️ Breaks with Windows updates

Dear Microsoft

Please stabilize the Virtual Desktop COM interfaces or provide a proper public API. Every third-party virtual desktop tool in the ecosystem depends on reverse-engineered GUIDs that break with every update. A stable API for creating, switching, naming, and moving windows between virtual desktops would eliminate an entire class of fragility. PowerToys has asked for this too.

Prior Art & Credits

  • Markus Scholtes (MScholtes/VirtualDesktop) — the COM interface definitions we vendor are from his project (MIT license). He does the hard work of reverse-engineering and publishing updated GUIDs for every Windows build. This app and many others wouldn't be possible without his work.
  • Peach — MS Store app with similar hotkey UX
  • PowerToys feature requests #13993, #21597

License

MIT


Credit to Kieran Mockford for the original idea. May he rest in peace.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

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

> 标签

C#

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

> 工具信息

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

> 相关工具

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