简体   繁体   English

AutoHotKey:使 Win+Tab 充当 Alt+Tab,但将所有其他 Win+ 组合重新映射为 Ctrl+

[英]AutoHotKey: make Win+Tab act as Alt+Tab, but remap all other Win+ combinations as Ctrl+

I am trying to make my MacBook in Windows behave similar to macOS: so I can switch between apps using Win + Tab (ie, replicate the Alt+Tab action), but have all the Ctrl + ... actions (like, Ctrl + C , Ctrl + V , Ctrl + Z , etc) be accessible using the Win key ( Win + C , Win + V , Win + Z ).我试图让我的 MacBook 在 Windows 中的行为类似于 macOS:所以我可以使用Win + Tab (即复制 Alt+Tab 操作)在应用程序之间切换,但拥有所有Ctrl + ...操作(例如, Ctrl + CCtrl + VCtrl + Z等)可以使用 Win 键( Win + CWin + VWin + Z )访问。

In other words, I am trying to :换句话说,我试图:

  1. Remap Win key to Ctrl in all key combinations, but also在所有组合键中将Win键重新映射到Ctrl ,但也
  2. Have the Win + Tab act exactly as Alt + Tab (and I don't care if Ctrl + Tab stops working as Ctrl + Tab , because I am not using that key combination at all).Win + TabAlt + Tab完全一样(我不在乎Ctrl + Tab 是否停止作为Ctrl + Tab 工作,因为我根本没有使用该组合键)。

I am able to separately individually achieve 1. using LWin::Ctrl , and 2. using LWin & Tab::AltTab , but I cannot make them work together.我可以分别实现 1. 使用LWin::Ctrl和 2. 使用LWin & Tab::AltTab ,但我不能让它们一起工作。 Whenever I have something like每当我有类似的东西

LWin::Ctrl
LWin & Tab::AltTab

or或者

LWin::Ctrl
Ctrl & Tab::AltTab

it just stops working.它只是停止工作。

Any help is appreciated.任何帮助表示赞赏。 I am using Windows 10.我正在使用 Windows 10。

Did you try to use the symbols like documented here ?您是否尝试使用此处记录的符号?

For your snippet that would mean:对于您的代码段,这意味着:

LWin::Ctrl
LWin & Tab::Send, !{Tab}

There is a problem with this, as it simulates closed keystokes (regard !{Tab} as {Alt Down}{Tab}{Alt Up} . If you want to press and hold Win and then use Tab (or eventually tab multiple times), this doesn't work. To adress this issue, I found three main workarounds:这有一个问题,因为它模拟了关闭的按键(将!{Tab}视为{Alt Down}{Tab}{Alt Up} 。如果您想按住Win然后使用Tab (或最终多次使用Tab ) ,这不起作用。为了解决这个问题,我找到了三个主要的解决方法:

  1. ) )

Let Alt stick to being pressed down:Alt保持按下状态:

LWin::Ctrl
LWin & Tab::Send, {Alt Down}{Tab}
LWin & Capslock::Send, {Alt Up} ;Suppose you won't use that hotkey elsewhere
  1. ) )

Use something this solution by 2501 :2501 之前使用此解决方案

h::AltTabMenu  ; Opens the menu. Press second time to close.
n::AltTab      ; Alt-Tabs through forwards
m::ShiftAltTab ; Alt-Tabs through backwards

The underlying principles/functionalities are documented here .此处记录基本原理/功能。

  1. ) Dig into AHK really deep: here (which is referenced in 1 ) ) 深入研究 AHK: here (在1 中引用)

Annotation: Be aware that注释:请注意

<#::Ctrl
<#Tab::!Tab

does not work as Windows then handles the win key on its own first.不起作用,因为 Windows 然后首先自己处理win键。 You can verify This by testing:您可以通过测试来验证这一点:

<#::
MsgBox test
return
<#Tab::
MsgBox test
return

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM