AutoHotKey Script for Swapped Ctrl/Alt Keys
This is the AutoHotKey script I use after swapping Ctrl and Alt keys with SharpKeys on Windows. See My Windows 10 Setup for the full context, and AutoHotKey for a description of the tool.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
; #Reload on
; REMEMBER!!! MY ALT AND CTRL KEYS ARE SWAPPED!!!
; workarounds if ctrl and alt are SWAPPED ( Recommended )
; Figured the following ctrl-tab stuff out from the last post here https://www.autohotkey.com/boards/viewtopic.php?t=70379
; Remap Ctrl-Tab to Alt-Tab
^Tab::
Send {Alt down}{Tab}
Keywait Ctrl
Send {Alt up}
return
; Remap Ctrl-Shift-Tab to Alt-Shift-Tab
^+Tab::
Send {Alt down}{Shift down}{Tab}
Keywait Ctrl
^Space::Send !{Space}
!c::Send, ^c
!+^4::Send {CtrlUp}{ShiftUp}{AltUp}#+s
; From https://www.autohotkey.com/boards/viewtopic.php?t=62837
; -----------------------------------------------------------
; Sane Navigation Shortcuts with Alt
;
; Alt + left arrow = Home
; Alt + right arrow = End
; Alt + up arrow = PgUp
; Alt + down arrow = PgDn
; -----------------------------------------------------------
; using left Ctrl
<^Up::send {LCtrl Up}{PgUp}
<^Down::send {LCtrl Up}{PgDn}
<^Left::send {LCtrl Up}{Home}
<^Right::send {LCtrl Up}{End}
; Ctrl + PgUp/Down, Home/End for text editors and word processors
<^+Up::send {LCtrl Up}{Shift Up}+{PgUp}
<^+Down::send {LCtrl Up}{Shift Up}+{PgDn}
<^+Left::send {LCtrl Up}{Shift Up}+{Home}
<^+Right::send {LCtrl Up}{Shift Up}+{End}
It may be possible to use AutoHotKey without SharpKeys and achieve a satisfactory result, but the script would grow exponentially due to needing to handle each app use case individually. Using both together is the cleaner solution.