Created
June 12, 2024 03:03
-
-
Save pietrofxq/58080ac26b682f08db7fe5aefd116db7 to your computer and use it in GitHub Desktop.
Use this to swap Left and Ctrl and have Ctrl + Tab working as Alt+tab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MaxThreadsPerHotkey 3 | |
SetBatchLines, -1 | |
; Swap LeftCtrl and LeftAlt while maintaining Alt+Tab behavior | |
*LCtrl:: | |
CtrlTabbed := false | |
Hotkey, *Tab, CtrlTab, On ; Enable Ctrl+Tab handling | |
Send {Alt Down} ; Press Alt (LCtrl::Alt) | |
KeyWait, LCtrl | |
if CtrlTabbed | |
Send {Ctrl Up} ; Release Ctrl after Ctrl+Tabbing | |
else | |
Send {Alt Up} ; Release Alt (LCtrl::Alt) | |
Hotkey, *Tab, CtrlTab, Off ; Disable Ctrl+Tab handling | |
CtrlTabbed := false | |
return | |
CtrlTab: | |
if (!CtrlTabbed) { | |
Send {Alt Up} ; Release Alt now | |
Send {Ctrl Down} ; Press down Ctrl | |
CtrlTabbed := true ; Set a flag so we know to release Ctrl instead of Alt | |
} | |
Send {Blind}{Tab} ; Press Tab without releasing any modifiers | |
; No need to release Ctrl here because it will be released when LCtrl is released | |
return | |
; Swap LeftAlt and LeftCtrl while maintaining Alt+Tab behavior | |
*LAlt:: | |
AltTabbed := false | |
Hotkey, *Tab, AltTab, On ; Enable Alt+Tab handling | |
Send {Ctrl Down} ; Press Ctrl (LAlt::Ctrl) | |
KeyWait, LAlt | |
if AltTabbed | |
Send {Alt Up} ; Release Alt after Alt+Tabbing | |
else | |
Send {Ctrl Up} ; Release Ctrl (LAlt::Ctrl) | |
Hotkey, *Tab, AltTab, Off ; Disable Alt+Tab handling | |
AltTabbed := false | |
return | |
AltTab: | |
if (!AltTabbed) { | |
Send {Ctrl Up} ; Release Ctrl now | |
Send {Alt Down} ; Press down Alt (Keeps the Alt+Tab menu open) | |
AltTabbed := true ; Set a flag so we know to release Alt instead of Ctrl | |
} | |
Send {Blind}{Tab} ; Press Tab without releasing any modifiers | |
; No need to release Alt here because it will be released when LAlt is released | |
return | |
; Handle Right Alt separately | |
RAlt:: | |
Send {RAlt Down} | |
KeyWait, RAlt | |
Send {RAlt Up} | |
return | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment