29

In Windows 10, the shortcut keys for switching virtual desktop are ctrl + win + right / left arrow. I'd like to simplify it, by changing it to ctrl + right or left arrow key only. How can I do this?

1
  • 1
    Here's a gist for those who are used to Unity's Ctrl + Alt + Left/Right
    – Yibo Yang
    Jul 19, 2016 at 1:59

3 Answers 3

20

AutoHotkey is a great program for doing this exact type of thing. It is an very useful program for remapping keyboard keys, letting you set up hotkeys, and automating tasks. Here are the steps to set this up:

  1. Download AutoHotkey (http://www.autohotkey.com/) and install it.
  2. Right-click on your desktop > New > Autohotkey Script (name it whatever you want).
  3. Right-click, Edit Script.
  4. Paste the following text under the already-present text:

#NoTrayIcon ^Right::^#Right ^Left::^#Left

  1. Save and run the script to test its functionality.
  2. If it performs as expected, copy the script into the startup folder* so that it will run every time your computer starts.

Optionally, you can compile the script to run as a standalone .exe that can be run on other computers that don't have AutoHotkey installed. To do this, right-click the script file, and click "Compile Script."

*To access the startup folder in Windows 10, open "Run" (either press Windows Key + R, or search for it in the start menu) and type either (without quotes): "shell:startup" (to run the script for just the current user) or "shell:common startup" (to run it for all users). Paste it in the folder that opens.

7
  • 4
    If you have boat loads of Virtual Desktops, you might want to change to desktop number X. This is quiet difficult from pure AHK, but I've created a DLL to do just that, it's especially meant for AHK and available in GitHub.
    – Ciantic
    Oct 24, 2015 at 21:09
  • 1
    Is there a native solution?
    – valkirilov
    Feb 23, 2016 at 17:05
  • @valkirilov: Not that I know of. If anyone else knows of a way, feel free to chime in if you happen to run across this.
    – NateR
    Feb 24, 2016 at 5:31
  • @ElectroPulse I tried your method but when I assign ^!Right (Ctrl + Alt + Arrow) it is not working, do you have any ideas why?
    – valkirilov
    Feb 25, 2016 at 7:53
  • @valkirilov Hmm... That's strange. I just reproduced the issue. I am able to use it to open a message box using MsgBox, but am unable to remap ctrl+alt+right to any keypresses. Very strange, no idea why... I don't know the inner workings of Autohotkey well enough to have an answer.
    – NateR
    Mar 4, 2016 at 2:21
5

To respond @valkirilov's comment under ElectroPulse's answer, I see this post is helpful. Remapping Ctrl-Alt-Arrow in Windows 10 using AutoHotkey

In short, using

!^Right:: send {LWin down}{LCtrl down}{Right}{LWin up}{LCtrl up}
!^Left:: send {LWin down}{LCtrl down}{Left}{LWin up}{LCtrl up}
2
  • Thank you! Microsoft takes one of the best features from Linux desktops and doesn't even map the keypresses properly? This will save me! Jul 26, 2016 at 18:01
  • I like this one better becasue !^ is more efficient than ^. CTRL+Arrow is very important and reserved. But CTRL+Win+Arrow is not reserved. Nov 9, 2017 at 2:06
3

I created some shortcuts for switching between desktops. I wanted a 3x3 grid of desktops (virtually, or in my mind-map only--in reality they are linear). I wanted the number pad keys to map to each desktop respectively.

The way the hotkeys work is by

  • assuming there are 9 desktops total
  • scrolling at least 9 to the left/right to ensure we're at a linear edge of known desktops
  • scrolling back the right number to get where I want.

Since there is no easy way to move a window to a specific desktop, I used Win+Numpad0 to bring up the "move to desktop" menu for that window. It's a compromise I have little hope of resolving soon (but I did post my own question about it).

Here are my shortcuts:

; Windows+Number pad keys = Windows 10 desktop switching.
; number pad to match a 3x3 desktop
#Numpad1::
#NumpadEnd::
    Send, {LWin down}{Ctrl down}{Right 9}{Left 2}{Ctrl up}{LWin up}
    return
#Numpad2::
#NumpadDown::
    Send, {LWin down}{Ctrl down}{Right 9}{Left 1}{Ctrl up}{LWin up}
    return
#Numpad3::
#NumpadPgDn::
    Send, {LWin down}{Ctrl down}{Right 9}{Ctrl up}{LWin up}
    return
#Numpad4::
#NumpadLeft::
    Send, {LWin down}{Ctrl down}{Left 9}{Right 3}{Ctrl up}{LWin up}
    return
#Numpad5::
#NumpadClear::
    Send, {LWin down}{Ctrl down}{Left 9}{Right 4}{Ctrl up}{LWin up}
    return
#Numpad6::
#NumpadRight::
    Send, {LWin down}{Ctrl down}{Right 9}{Left 3}{Ctrl up}{LWin up}
    return
#Numpad7::
#NumpadHome::
    Send, {LWin down}{Ctrl down}{Left 9}{Ctrl up}{LWin up}
    return
#Numpad8::
#NumpadUp::
    Send, {LWin down}{Ctrl down}{Left 9}{Right 1}{Ctrl up}{LWin up}
    return
#Numpad9::
#NumpadPgUp::
    Send, {LWin down}{Ctrl down}{Left 9}{Right 2}{Ctrl up}{LWin up}
    return
;   Send, {LWin down}{Tab}{LWin up}
;   Sleep, 3000
;   Send, {Tab 1}{Right 2}
;   Sleep, 3000
;   Send, {Enter}
;   Sleep, 3000
;   return
;
;   Bring up the "move this window to desktop..." menu.  Since the menu is always different, don't operate on it.  Just leave it at that.
#!Numpad0::
#!NumpadIns::
#+Numpad0::
#+NumpadIns::
#Numpad0::
#NumpadIns::
    Send, {LWin down}{Tab}{LWin up}
    Sleep, 400
    Send, {AppsKey}M
return

Not the answer you're looking for? Browse other questions tagged .