Last active
March 11, 2018 21:22
-
-
Save rrotter/c4aae3fe732f06b1adbdbbd99eb9abca to your computer and use it in GitHub Desktop.
Make Surface Book 2 Keyboard shortcuts as Mac-like as possible
This file contains 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
#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. | |
; First, use a registry remapping tool like SharpKeys to swap Alt and Ctrl | |
; This is an exercise left to the reader. | |
; (I map both Alts to Right Ctrl, Caps to LCtrl, and the Application Key to RWin. You should at least make all Ctrls | |
; Alts and all Alts Ctrls) | |
; Use Ctrl+Tab as Alt+Tab | |
RCtrl & Tab::AltTab | |
; swap command and option arrow (really ctrl and fn) | |
Home::^Left | |
End::^Right | |
^Left::Send {Home} | |
^Right::Send {End} | |
^+Left::Send +{Home} | |
^+Right::Send +{End} | |
; chrome, ff tab switch, fwd/back | |
#If WinActive("ahk_exe chrome.exe") || WinActive("ahk_exe firefox.exe") | |
^]::Send !{Right} | |
^[::Send !{Left} | |
^#]::Send {RWinUp}{LWinUp}^{Tab} | |
^#[::Send ^+{Tab} |
This file contains 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
#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. | |
; base | |
; mapped in registry w/ SharpKeys: | |
; Caps::LCtrl | |
; Alt::RCtrl | |
; LCtrl::LAlt | |
; Application::RWin | |
; | |
; To test correct registry mappings: | |
; Run an AHK script w/ these mappings: | |
; LCtrl::b | |
; LShift::i | |
; LAlt::z | |
; RAlt::x | |
; LWin::a | |
; RCtrl::r | |
; RWin::e | |
; press each key from Caps to App (skip space and Fn) | |
; (Caps, LShift, LCtrl, LWin, LAlt, RAlt, AppKey) | |
; spells 'bizarre' | |
; Disable win space (layout switch) | |
#Space:: | |
; Fix Alt+Tab | |
RCtrl & Tab::AltTab | |
; ; swap command and option arrow (really ctrl and fn) | |
Home::^Left | |
End::^Right | |
#If !WinActive("ahk_exe Hyper.exe") | |
^Left::Send {Home} | |
^Right::Send {End} | |
^+Left::Send +{Home} | |
^+Right::Send +{End} | |
#If WinActive("ahk_exe Hyper.exe") | |
^Left::^a | |
^Right::^e | |
; make lower ctrl keys and tab switch work in terminals | |
#If WinActive("ahk_class mintty") | |
RCtrl & v::+Ins | |
RCtrl & c::^Ins | |
RCtrl & w::Send !{f4} | |
RCtrl & n::Send !{f2} | |
#If WinActive("ahk_exe Hyper.exe") | |
RCtrl & v::^+v | |
RCtrl & c::^+c | |
RCtrl & t::^+t | |
RCtrl & n::^+n | |
RCtrl & w::^+w | |
^#]::Send {RWinUp}{LWinUp}^{Tab} | |
^#[::Send ^+{Tab} | |
; ^w FTW | |
#If !WinActive("ahk_exe Hyper.exe") && !WinActive("ahk_class mintty") | |
LCtrl & w::^Backspace | |
; chrome tab switch, fwd/back | |
#If WinActive("ahk_exe chrome.exe") || WinActive("ahk_exe firefox.exe") | |
^]::Send !{Right} | |
^[::Send !{Left} | |
^#]::Send {RWinUp}{LWinUp}^{Tab} | |
^#[::Send ^+{Tab} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
keys.ahk is the abridged version. real_keys.ahk is what I actually use, but the difference is just needless complication if you don't use terminal apps. If you do spend a lot of time in the terminal, but use different terminal emulators than I do (MinTTY and Hyper) this can be simply adapted.
real_keys.ahk assumes you are using all of my SharpKeys remappings, and not just swapping Alt and Ctrl. This isn't so much to emulate Mac keyboards as it is to emulate Mac keyboards as I personally customize them.