{"id":13457123,"url":"https://github.com/pmb6tz/windows-desktop-switcher","last_synced_at":"2025-05-15T20:04:58.040Z","repository":{"id":37470256,"uuid":"51282144","full_name":"pmb6tz/windows-desktop-switcher","owner":"pmb6tz","description":"An AutoHotKey script for Windows that lets a user change virtual desktops by pressing CapsLock + \u003cnum\u003e. ","archived":false,"fork":false,"pushed_at":"2024-06-25T18:02:58.000Z","size":260,"stargazers_count":1277,"open_issues_count":36,"forks_count":233,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-14T03:50:57.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"AutoHotkey","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/pmb6tz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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},"funding":{"ko_fi":"windows_desktop_switcher"}},"created_at":"2016-02-08T06:13:18.000Z","updated_at":"2025-05-11T09:44:01.000Z","dependencies_parsed_at":"2023-01-20T21:18:56.758Z","dependency_job_id":"f3f04fe9-ea7a-41ca-b270-c05db19a4046","html_url":"https://github.com/pmb6tz/windows-desktop-switcher","commit_stats":{"total_commits":82,"total_committers":13,"mean_commits":"6.3076923076923075","dds":"0.31707317073170727","last_synced_commit":"5d5a92684b0addb62150e28c417a1b3e5f2a7377"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb6tz%2Fwindows-desktop-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb6tz%2Fwindows-desktop-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb6tz%2Fwindows-desktop-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb6tz%2Fwindows-desktop-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmb6tz","download_url":"https://codeload.github.com/pmb6tz/windows-desktop-switcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414499,"owners_count":22067272,"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":[],"created_at":"2024-07-31T08:01:33.502Z","updated_at":"2025-05-15T20:04:51.297Z","avatar_url":"https://github.com/pmb6tz.png","language":"AutoHotkey","funding_links":["https://ko-fi.com/windows_desktop_switcher","https://ko-fi.com/U6U82G0A5"],"categories":["AutoHotkey"],"sub_categories":[],"readme":"[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/U6U82G0A5)\n\n# windows-desktop-switcher\nAn AutoHotkey script for Windows that lets a user switch virtual desktops by pressing \u003ckbd\u003eCapsLock\u003c/kbd\u003e and a number row key at the sime time (e.g. \u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e2\u003c/kbd\u003e to switch to Desktop 2). It also provides other features, such as customizing the key combinations, creation/deletion of desktops by hotkey, etc. (see Hotkeys section below).\n\n## Hotkeys\n\nAction | Keys \n--- | :-:\n**Switch** to virtual desktop **1, 2, etc.**\u003cbr\u003e*(you can also use the Numpad)*|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e1\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e2\u003c/kbd\u003e\u003cbr\u003e...\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e9\u003c/kbd\u003e\n**Switch back** to the last desktop used|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eTab\u003c/kbd\u003e\n**Switch** to the virtual desktop on the **left**\u003cbr\u003e*(auto-cycles from the first to the last desktop)*|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eA\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eP\u003c/kbd\u003e\n**Switch** to the virtual desktop on the **right**\u003cbr\u003e*(auto-cycles from the last to the first desktop)*|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eS\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eN\u003c/kbd\u003e\n**Create** a new virtual desktop|**\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eC\u003c/kbd\u003e**\n**Delete** the current virtual desktop|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eD\u003c/kbd\u003e\n**Move** the current window to another desktop, then switch to it\u003cbr\u003e*Keys \u003ckbd\u003eQ\u003c/kbd\u003e, \u003ckbd\u003eW\u003c/kbd\u003e, etc. correspond to **1st, 2nd, etc.** desktops*|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eQ\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eW\u003c/kbd\u003e\u003cbr\u003e...\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003eO\u003c/kbd\u003e\n**Move** the current window to the previous or the next desktop, then switch to it|\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e←\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e→\u003c/kbd\u003e\n\nNote, \u003ckbd\u003eCapsLock\u003c/kbd\u003e continues to function normally even when it is used as a modifier. [But you can make the button do more useful things such as open overview, or disable it altogether](https://github.com/pmb6tz/windows-desktop-switcher/issues/67).\n\nIf you'd like, you can [enable the alternate configuration](https://github.com/pmb6tz/windows-desktop-switcher/issues/44), to use \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eAlt\u003c/kbd\u003e as hotkey combination keys instead of \u003ckbd\u003eCapsLock\u003c/kbd\u003e (e.g. use \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003e1\u003c/kbd\u003e to switch to the Desktop 1, just as you would use \u003ckbd\u003eCapsLock\u003c/kbd\u003e + \u003ckbd\u003e1\u003c/kbd\u003e).\n\nAdditional hotkeys, such as [pinning a window or app on all workspaces](https://github.com/pmb6tz/windows-desktop-switcher/issues/55), can be added as well.\n\nYou can also customize the hotkeys and actions as described in the section below.\n\n## Overview\nThis script creates more convenient hotkeys for switching virtual desktops in Windows 10. I built this to better mirror the mapping I use on linux (with dwm), and it's always annoyed me that Windows does not have better hotkey support for this feature (for instance, there's no way to go directly to a desktop by number).\n\n## Running\n[Install AutoHotkey v1.1](https://autohotkey.com/download/1.1/AutoHotkey_1.1.37.02_setup.exe) (v2 is [not supported](https://github.com/pmb6tz/windows-desktop-switcher/issues/93) at this time), then run the `desktop_switcher.ahk` script (open with AutoHotkey if prompted). You can disable the switching animation by opening \"Adjust the appearance and performance of Windows\" and then unselecting the checkmark \"Animate windows when minimizing and maximizing\".\n\n### Notes about Windows 1809/1903≤ Updates\nThis project relies partly on [VirtualDesktopAccessor.dll](https://github.com/Ciantic/VirtualDesktopAccessor) (for moving windows to other desktops). This binary is included in this repository for convenience, and was recently updated to work with the 1809/1903≤ updates. \n\nThis may cause instability for users running older versions of Windows. If this is the case, [download the older DLL](https://github.com/pmb6tz/windows-desktop-switcher/blob/5289a0968179638f6e946a4cb69723510abd0d19/virtual-desktop-accessor.dll), rename it to `VirtualDesktopAccessor.dll`, and overwrite the previous DLL.\n\nIf a future Windows Update breaks the DLL again and updating your files from this repository doesn't work, you could try [building the DLL yourself](https://github.com/Ciantic/VirtualDesktopAccessor) (given that it was since updated by its' creators).\n\n## Customizing Hotkeys\nTo change the key mappings, modify the `user_config.ahk` script and then run `desktop_switcher.ahk` (program will restart if it's already running). Note, `!` corresponds to \u003ckbd\u003eAlt\u003c/kbd\u003e, `+` is \u003ckbd\u003eShift\u003c/kbd\u003e, `#` is \u003ckbd\u003eWin\u003c/kbd\u003e, and `^` is \u003ckbd\u003eCtrl\u003c/kbd\u003e. A more detailed description of hotkeys can be found [here](https://autohotkey.com/docs/Hotkeys.htm). The syntax of the config file is `HOTKEY::ACTION`. Here are some examples of the customization options. \n\nSingle line of code example | Meaning\n--- | ---\n`!n::switchDesktopToRight()`\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; | **Hotkey:** \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003eN\u003c/kbd\u003e\u003cbr\u003e**Action:** Switch to the desktop on the right\n`#!space::switchDesktopToRight()` | **Hotkey:** \u003ckbd\u003eWin\u003c/kbd\u003e + \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003eSpace\u003c/kbd\u003e\u003cbr\u003e**Action:** Switch to the desktop on the right\n`CapsLock \u0026 n::switchDesktopToRight()` | **Hotkey:** \u003ckbd\u003eCapslock\u003c/kbd\u003e + \u003ckbd\u003eN\u003c/kbd\u003e\u003cbr\u003e**Action:** Switch to the desktop on the right\u003cbr\u003e*(\u0026 is necessary when using a non-modifier key such as Capslock)*\n`!n::switchDesktopToRight()` | **Hotkey:** \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003eN\u003c/kbd\u003e\u003cbr\u003e**Action:** Switch to the desktop on the right\n`^space::send, #{tab} ` | **Hotkey:** \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eSpace\u003c/kbd\u003e\u003cbr\u003e**Action:** Open Desktop Manager by sending \u003ckbd\u003eWin\u003c/kbd\u003e + \u003ckbd\u003eTab\u003c/kbd\u003e\n\nA more detailed description of hotkeys can be found here: [AutoHotkey docs](https://autohotkey.com/docs/Hotkeys.htm).\u003cbr\u003e\nYou can find the explanation for the Desktop Manager hotkey [here](https://github.com/pmb6tz/windows-desktop-switcher/issues/41).\u003cbr\u003e\nAfter any changes to the configuration the program needs to be closed and opened again.\n\n## Running on boot\n\nYou can make the script run on every boot with either of these methods.\n\n### Simple (Non-administrator method)\n\n1. Press \u003ckbd\u003eWin\u003c/kbd\u003e + \u003ckbd\u003eR\u003c/kbd\u003e, enter `shell:startup`, then click \u003ckbd\u003eOK\u003c/kbd\u003e\n2. Create a shortcut to the `desktop_switcher.ahk` file here\n\n### Advanced (Administrator method)\n\nWindows prevents hotkeys from working in windows that were launched with higher elevation than the AutoHotKey script (such as CMD or Powershell terminals that were launched as Administrator). As a result, Windows Desktop Switcher hotkeys will only work within these windows if the script itself is `Run as Administrator`, due to the way Windows is designed. \n\nYou can do this by creating a scheduled task to invoke the script at logon. You may use 'Task Scheduler', or create the task in powershell as demonstrated.\n```\n# Run the following commands in an Administrator powershell prompt. \n# Be sure to specify the correct path to your desktop_switcher.ahk file. \n\n$A = New-ScheduledTaskAction -Execute \"PATH\\TO\\desktop_switcher.ahk\"\n$T = New-ScheduledTaskTrigger -AtLogon\n$P = New-ScheduledTaskPrincipal -GroupId \"BUILTIN\\Administrators\" -RunLevel Highest\n$S = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 0\n$D = New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S\nRegister-ScheduledTask WindowsDesktopSwitcher -InputObject $D\n```\n\nThe task is now registered and will run on the next logon, and can be viewed or modified in 'Task Scheduler'. \n\n## Q\u0026A\n\n#### How to prevent cycling of desktop switching when end desktop or start desktop is reached?\n\nSolution is described in [#66](https://github.com/pmb6tz/windows-desktop-switcher/issues/66#issuecomment-741793147).\n\n#### How to create a specific number of desktops after the application is started?\n\nSolution is described in [#69](https://github.com/pmb6tz/windows-desktop-switcher/issues/69#issuecomment-786976955).\n\n#### How to see at a glance, which of the desktops am I currently on (i.e. show a number of the current desktop as a tray bar icon)?\n\nSolution is described in [#50](https://github.com/pmb6tz/windows-desktop-switcher/issues/50#issuecomment-935875918).\n\n## Credits\n\n- Thanks to [Ciantic/VirtualDesktopAccessor](https://github.com/Ciantic/VirtualDesktopAccessor) (DLL) and [sdias/win-10-virtual-desktop-enhancer](https://github.com/sdias/win-10-virtual-desktop-enhancer) (DLL usage samples), our code can now move windows between desktops.\n\n## Other\nTo see debug messages, download [SysInternals DebugView](https://technet.microsoft.com/en-us/sysinternals/debugview).\n\nThis script is intended to be lightweight in order to prioritize performance and robustness. For more advanced features (such as configuring different wallpapers on different desktops) check out https://github.com/sdias/win-10-virtual-desktop-enhancer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmb6tz%2Fwindows-desktop-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmb6tz%2Fwindows-desktop-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmb6tz%2Fwindows-desktop-switcher/lists"}