Windows 10 virtual desktop switch animation
Show windows-desktop-switcherAn AutoHotkey script for Windows that lets a user switch virtual desktops by pressing CapsLock and a number row key at the sime time (e.g. CapsLock + 2 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). Hotkeys
Note, CapsLock 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. If you'd like, you can enable the alternate configuration, to use Ctrl + Alt as hotkey combination keys instead of CapsLock (e.g. use Ctrl + Alt + 1 to switch to the Desktop 1, just as you would use CapsLock + 1). Additional hotkeys, such as pinning a window or app on all workspaces, can be added as well. You can also customize the hotkeys and actions as described in the section below. OverviewThis 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). RunningInstall AutoHotkey v1.1 or later, 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". Notes about Windows 1809/1903 UpdatesThis project relies partly on VirtualDesktopAccessor.dll (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. This may cause instability for users running older versions of Windows. If this is the case, download the older DLL, rename it to VirtualDesktopAccessor.dll, and overwrite the previous DLL. If 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 (given that it was since updated by its' creators). Customizing HotkeysTo 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 Alt, + is Shift, # is Win, and ^ is Ctrl. A more detailed description of hotkeys can be found here. The syntax of the config file is HOTKEY::ACTION. Here are some examples of the customization options.
A more detailed description of hotkeys can be found here: AutoHotkey docs. Running on bootYou can make the script run on every boot with either of these methods. Simple (Non-administrator method)
Advanced (Administrator method)Windows 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. You 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. # Run the following commands in an Administrator powershell prompt.
# Be sure to specify the correct path to your desktop_switcher.ahk file.
$A = New-ScheduledTaskAction -Execute "PATH\TO\desktop_switcher.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 WindowsDesktopSwitcher -InputObject $D
The task is now registered and will run on the next logon, and can be viewed or modified in 'Task Scheduler'. Q&AHow to prevent cycling of desktop switching when end desktop or start desktop is reached?Solution is described in #66. How to create a specific number of desktops after the application is started?Solution is described in #69. 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)?Solution is described in #50. Credits
OtherTo see debug messages, download SysInternals DebugView. This 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. |