How do you make your alt+tab functionality work like OSX where it uses meta+tab and not alt+tab, while also respecting the shift key?
I have the solution for this. Note the date of this post because I've gone through many apparently obsolete solutions before figuring this out. I've worked on this problem for a total of about 4 hours and have encountered a plethora of solutions that don't work. I'm a professional developer of 10 years but this problem nearly killed me.
There is a special keyword to replicate Alt + Tab
functionality.
I also realized that AutoHotkey will block keyboard signals until you've completed the shortcut by releasing all keys, so any additional tabs that are sent while I held down the control key are ignored.
Yes, it does that. Hotkeys create something they call "threads" and by default there can be only one. So if you want to trigger the same hotkey again before the previous "thread" has finished, you can use #MaxThreadsPerHotkey directive.
The code below swaps Alt + Tab
and Ctrl + Tab
functionality — that is Ctrl + Tab
will switch between apps and Alt + Tab
between tabs in a browser. The thread limit is 255 which means that you can hold Ctrl
and (in theory) press Tab
255 times before it stops working.
#UseHook
SendMode Input
#MaxThreads 255
#MaxThreadsPerHotkey 255
<!Tab::
Send {LCtrl down}{Tab}
Keywait LAlt
Send {LCtrl up}
return
#MaxThreadsPerHotkey
<^Tab::AltTab
I think I've spent more time trying to make AHK hotkeys do what I want than they could possibly save me even if I lived to a hundred.
<#Tab::AltTab
This will remap "win + tab" to "alt tab". It also works with multiple presses of the tab key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With