问题
Windows 10 has finally multi desktops, you can switch desktops with ctrl+win+right (or left) keys. It's a nice feature, but you have two use two hands to switch desktops. I'm trying to map the keys like this with autohotkey so I can use just one hand and keep the other one in the mouse..
ctrl + mouse wheel up --> ctrl + win + right
ctrl + mouse wheel down --> ctrl + win + left
the message box comes up so the ctrl + wheel up is working, but it doesn't switches desktops.
~LControl & WheelUp::
MsgBox, Go to desktop right.
Send, {ctrl up}{lwin ctrl righ}
return
~LControl & WheelDown::
MsgBox, Go to desktop left.
Send, {ctrl up}{lwin ctrl left}
return
Any idea why is this not working?.
回答1:
Inside {}
only one key should be specified and I think there's no need for passthrough modifier ~
:
LCtrl & WheelUp::Send, {LCtrl up}{LWin down}{LCtrl down}{Right}{LWin up}{LCtrl up}
LCtrl & WheelDown::Send, {LCtrl up}{LWin down}{LCtrl down}{Left}{LWin up}{LCtrl up}
Maybe the standard syntax for modifier keys will also work without sending up-event for LCtrl
key:
LCtrl & WheelUp::Send, #{Right}
LCtrl & WheelDown::Send, #{Left}
回答2:
You can easily switch between two virtual desktops in Windows 10 by using Ctrl+Win+→ or Ctrl+Win+← shortcuts.
But to make this even simpler and easy to use I’ve made this Autohotkey script to toggle betweeen two virtual desktops by just using the (`) key which is the least used key in keyboard.
`::
if (Toggle := !Toggle)
Send #^{right}
else
Send #^{left}
return
Note:- This script works for switching between two desktops only. For creating another virtual desktop you can use the shortcut Ctrl+Win+D.
来源:https://stackoverflow.com/questions/32685314/how-can-i-change-the-keys-to-change-desktop-in-windows-10-with-autohotkey