如何使用 autohotkey 更改 windows 10 中的桌面更改键?

How can I change the keys to change desktop in windows 10 with autohotkey?

Windows10终于多桌面了,可以用ctrl+win+切换桌面右(或)键。这是一个不错的功能,但您需要用两只手来切换桌面。 我正在尝试使用 autohotkey 映射这样的键,这样我就可以只用一只手,而将另一只手放在鼠标中..

ctrl + mouse wheel up   --> ctrl + win + right
ctrl + mouse wheel down --> ctrl + win + left

出现消息框,因此 ctrl + 向上滚动可以正常工作,但它不会切换桌面。

~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

知道为什么这不起作用吗?

{} 中只应指定一个键,我认为不需要 passthrough 修饰符 ~:

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}

也许修饰键的 the standard syntax 也可以在不发送 LCtrl 键的向上事件的情况下工作:

LCtrl & WheelUp::Send, #{Right}
LCtrl & WheelDown::Send, #{Left}

您可以在 Windows 10 中使用 Ctrl+Win+[=19= 轻松切换两个虚拟桌面]→或Ctrl+Win+快捷键。

但为了使它更简单易用,我制作了这个 Autohotkey 脚本,只需使用键盘中最少使用的 (`) 键即可在两个虚拟桌面之间切换。

`::
if (Toggle := !Toggle)
    Send #^{right}
else
    Send #^{left}
return

注意:- 此脚本仅适用于在两个桌面之间切换。要创建另一个虚拟桌面,您可以使用快捷键 Ctrl+Win+D。

我知道这是一个老问题,但现在有一个更好的解决方案,它有 Microsoft 的官方支持并且非常易于使用。微软最近发布了一款名为 Powertoys https://github.com/microsoft/PowerToys 的开源工具。它包括一个键盘管理器和一个用于重新映射键盘快捷键的工具。真的很简单。