Hyprland-style virtual desktop management for Windows 11.
Zero GUI. Pure keyboard. Instant switching.
This is a fork of pmb6tz/windows-desktop-switcher
Win-Hypr brings the workflow philosophy of Hyprland ~ the beloved Wayland compositor for Linux -- to Windows 11.
Instead of clicking through the clunky Task View, you get instant, numbered workspace switching with a single keystroke. Desktops are created dynamically on demand -- press Super+7 and desktops 1 through 7 will exist, instantly.
Built on AutoHotkey v2 and powered by VirtualDesktopAccessor.dll, Win-Hypr is lightweight, hackable, and fast.
| Feature | Description |
|---|---|
| Instant Switch | Jump directly to any desktop 1-9 with Super+N |
| Dynamic Creation | Desktops are created automatically if they don't exist yet |
| Window Teleport | Move the focused window to any desktop with Super+Shift+N |
| Focus Retention | Moved windows stay focused -- no lost activation |
| Spam Protection | Built-in transition lock prevents Explorer crashes from rapid inputs |
| Deterministic Creation | Pre-calculates exact desktop deficit ~ no overshoot, no race conditions |
| Zero GUI | No tray menus, no popups, no settings windows ~ just keys |
All keybinds are defined in keybinds.ahk and can be freely customized.
| Keys | Action |
|---|---|
| Super + 1 – 9 | Switch to desktop 1–9 (auto-creates if needed) |
| Super + Ctrl + ← / → | Cycle desktops left / right |
| Keys | Action |
|---|---|
| Super + Shift + 1 – 9 | Move active window to desktop 1–9 and follow it |
| Super + Q | Close active window |
| Super + V | Toggle maximize / restore |
| Keys | Action |
|---|---|
| Ctrl + Alt + T | Open Windows Terminal |
WinHypr-Switcher/
├── keybinds.ahk ← Entry point (run this as Admin)
├── WinHypr.ahk ← Backend API ~ DLL wrappers, smart logic, safety
├── VirtualDesktopAccessor.dll ← COM bridge to Windows virtual desktop API
├── setup.ps1 ← One-click installer (registers task + starts daemon)
├── uninstall.ps1 ← Clean uninstaller (kills daemon + removes task)
├── nuke.ps1 ← Ruthless directory deletion (force-closes file locks)
├── LICENSE
├── .gitignore
└── README.md
User presses Super+7
│
▼
keybinds.ahk -> SwitchToDesktop(7)
│
├─ isSwitching lock acquired
├─ GetDesktopCount() → 3
├─ Deficit: 7 - 3 = 4
├─ Loop 4 { CreateDesktop() } ← deterministic, no re-query
├─ GoToDesktopNumber(7) ← DLL call (1→0 index)
├─ _FocusForemostWindow()
└─ isSwitching lock released
Windows' virtual desktop API is 0-indexed (Desktop 1 = index 0). Win-Hypr's API functions accept 1-indexed numbers and translate internally -- you never think about zero-indexing.
When you switch to desktop N and only M desktops exist (N > M), Win-Hypr calculates needed = N - M once, then fires CreateDesktop() exactly needed times in a deterministic loop. It does not re-query GetDesktopCount() inside the loop -- this eliminates the race condition where the OS animation lags behind the DLL, causing overshoot.
A global isSwitching lock (with try/finally guarantee) prevents concurrent transitions. If a hotkey fires while a switch is already in progress, the input is silently dropped. This prevents Explorer crashes from interrupted desktop animations.
- Windows 11 (22H2 or later recommended)
- AutoHotkey v2.0+ -- do not install v1
- Sysinternals Handle (optional, for full removal) -- install via
winget install SysInternals.Handle
-
Clone or download:
git clone https://github.com/OpalAayan/WinHypr-Switcher.git -
Open PowerShell as Administrator and run:
cd path\to\WinHypr-Switcher powershell -ExecutionPolicy Bypass -File .\setup.ps1
That's it. The setup script will:
- ✅ Verify AutoHotkey v2 is installed
- ✅ Validate all required files (
keybinds.ahk,VirtualDesktopAccessor.dll) - ✅ Register a scheduled task to start Win-Hypr at logon (elevated)
- ✅ Launch the daemon immediately
Important
Windows blocks hotkeys from reaching windows that run at a higher privilege level than the AHK script. Always run Win-Hypr as Administrator — the setup script handles this automatically via the scheduled task.
Uninstalling is a two-step process: first disable Win-Hypr, then delete the folder.
Run the uninstall script to stop the daemon and remove the scheduled task:
powershell -ExecutionPolicy Bypass -File .\uninstall.ps1This will:
- Terminate the Win-Hypr daemon
- Remove the
WinHyprscheduled task (no more auto-start) - Verify everything is cleaned up
Project files are left in place (dormant). To re-enable later, just run setup.ps1 again.
Win-Hypr injects VirtualDesktopAccessor.dll into the system, which causes Windows to hold file locks (OS Error 32: File in Use) on the project directory. Explorer, terminal sessions, and IDE file-watchers can all prevent deletion.
nuke.ps1 handles this automatically. It will:
- Auto-discover the WinHypr-Switcher directory (via scheduled task, script location, or common paths)
- Unregister the
WinHyprscheduled task - Kill all AutoHotkey processes
- Detect IDE file-watchers (VS Code, VSCodium) and prompt to close them
- Redirect any Explorer windows browsing the target directory
- Force-close all open file handles using Sysinternals
handle.exe - Delete the directory (retry loop with handle re-scanning between attempts)
# Auto-discovers and nukes the directory:
powershell -ExecutionPolicy Bypass -File .\nuke.ps1
# Or specify the path explicitly:
powershell -ExecutionPolicy Bypass -File .\nuke.ps1 -TargetPath "C:\path\to\WinHypr-Switcher"
# Also force-kill VS Code / VSCodium:
powershell -ExecutionPolicy Bypass -File .\nuke.ps1 -ForceKillAppsNote
nuke.ps1 is self-relocating -- if you run it from inside the target directory, it will automatically copy itself to %TEMP% and relaunch. It also auto-escapes if your terminal is cd'd into the target. No manual steps required.
Tip
For best results, install Sysinternals Handle beforehand:
winget install SysInternals.HandleWithout handle.exe, the script can still kill processes and retry deletion, but cannot force-close individual file handles.
If you prefer to set things up manually:
-
Ensure
VirtualDesktopAccessor.dllis in the same directory as the.ahkfiles. -
Run as Administrator:
Right-click keybinds.ahk → Run as administrator -
Run on Boot — Create a scheduled task in an elevated PowerShell:
$A = New-ScheduledTaskAction -Execute "C:\Path\To\AutoHotkey64.exe" -Argument '"C:\Path\To\keybinds.ahk"' $T = New-ScheduledTaskTrigger -AtLogon $P = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest $S = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 0 $D = New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S Register-ScheduledTask WinHypr -InputObject $D
Important
Do not run setup/uninstall/nuke scripts using Nushell — use powershell -c "commands" or run from a native PowerShell session.
| Problem | Solution |
|---|---|
| Hotkeys don't work in elevated apps | Run keybinds.ahk as Administrator |
FATAL: Failed to load DLL |
Ensure VirtualDesktopAccessor.dll is in the script directory |
FATAL: Could not resolve DLL export |
Your DLL version may be incompatible with your Windows build. Download the latest DLL |
| Desktops overshoot (too many created) | Update to latest WinHypr.ahk — the deterministic loop fix resolves this |
| Explorer crashes on rapid switching | The spam lock should prevent this. If it persists, increase DEBOUNCE_MS in WinHypr.ahk |
| Can't delete the folder (OS Error 32) | Run nuke.ps1 — it force-closes all file locks and deletes the directory. See Nuke (full removal) above |
nuke.ps1 fails even after closing handles |
Some locks are held by protected system processes. Reboot and run nuke.ps1 immediately before opening anything |
Win-Hypr emits OutputDebug messages at every stage. To view them:
- Download DebugView from SysInternals
- Run DebugView as Administrator
- Filter for
[Win-Hypr]
[Win-Hypr v1.0.0] DLL loaded (handle: 0x7FF...)
[Win-Hypr] Resolved: GetDesktopCount -> 0x7FF...
[Win-Hypr v1.0.0] Desktops: 3 | Current: 1 | Ready
[Win-Hypr] SwitchToDesktop: Creating 4 desktop(s) (3 → 7)
[Win-Hypr] SwitchToDesktop: Switching 1 → 7
Edit keybinds.ahk to change any binding. The modifier syntax is:
| Symbol | Key |
|---|---|
# |
Super (Win) |
+ |
Shift |
^ |
Ctrl |
! |
Alt |
Example — remap desktop switching to Ctrl+Alt+1-9:
^!1::SwitchToDesktop(1)
^!2::SwitchToDesktop(2)
; ... etcSee the AutoHotkey v2 Hotkeys docs for full syntax.
- Ciantic/VirtualDesktopAccessor -- the DLL that makes programmatic desktop control possible
- pmb6tz/windows-desktop-switcher -- the original AHK v1 project that inspired this rewrite
- Hyprland -- Wayland window manager Thanks vaxry :3
MIT ~ see LICENSE.txt.
Just give credit
feel free to steal