Skip to content

Instantly share code, notes, and snippets.

@PMExtra
Last active June 16, 2022 11:39
Show Gist options
  • Save PMExtra/5e376856e65a019ac1c6c059cf234110 to your computer and use it in GitHub Desktop.
Save PMExtra/5e376856e65a019ac1c6c059cf234110 to your computer and use it in GitHub Desktop.
[MacKeyboard] AutoHotkey
SendMode Input
ConfirmToSignOut() {
MsgBox 0x40034, Confirm, Are you sure you want to quit all applications and log out now?`n`nIf you do nothing`, you will be logged out automatically in 60 seconds., 60
IfMsgBox Yes
DllCall("ExitWindowsEx")
IfMsgBox Timeout
DllCall("ExitWindowsEx")
}
MinimizeApp() {
WinGet ProcessPath, ProcessPath, A
WinGet List, List, ahk_exe %ProcessPath%
Loop % List
WinMinimize % "ahk_id " List%A_Index%
}
NextWindow() {
WinGet ProcessPath, ProcessPath, A
WinActivateBottom ahk_exe %ProcessPath%
}
; Common
!#Esc::Send ^+{Esc} ; Task Manager
#`::NextWindow() ; Next Window
F11::Send #d ; Show Desktop
#q::Send !{F4} ; Quit
^#q::DllCall("LockWorkStation") ; Lock Screen
+#q::ConfirmToSignOut() ; Sign Out
+!#q::DllCall("ExitWindowsEx") ; Sign Out without Confirm
#r::Send ^r ; Refresh / Run / Replace
#+r::Send ^+r ; Force Refresh
#h::WinMinimize A ; Minimize
!#h::Send #{Home} ; Minimize All But This
#c::Send ^{Insert} ; Copy
#v::Send +{Insert} ; Paste
#m::WinMinimize A ; Minimize
!#m::MinimizeApp() ; Minimize App
^Left::Send ^#{Left} ; Previous Desktop
^Right::Send ^#{Right} ; Next Desktop
^#Space::Send #. ; Character Viewer
!BackSpace::Send ^{BackSpace} ; Delete Word
#BackSpace::Send {Delete} ; Delete
; Finder / Explorer
#i::Send !{Enter} ; Info / Properties
; Instant Messaging (QQ, WeChat, etc.)
^#a::Send ^!a ; Take Snapshot
^#z::Send ^!z ; Wake Up QQ
^#w::Send ^!w ; Wake Up Wechat
#Enter::Send ^{Enter} ; Send Message / Break Line
; TODO: Use a pattern to remap these all
#w::Send ^w ; Close Window
#t::Send ^t ; New Tab
+#t::Send ^+t ; Reopen Closed Tab
#y::Send ^h ; Hitory
#o::Send ^o ; Open
#p::Send ^p ; Print
#a::Send ^a ; Select All
#s::Send ^s ; Save
#+s::Send ^+s ; Save As / Save All
#d::Send ^d ; Add to Favorites
#f::Send ^f ; Find...
#+f::Send ^+f ; Find in Files
!#f::Send ^h ; Find and Replace...
#g::Send ^g ; Go to / Find Next
#z::Send ^z ; Undo
+#z::Send ^y ; Redo
#x::Send ^x ; Cut
#n::Send ^n ; New File / New Window
+#n::Send ^+n ; New Window / New InPrivate Window
#/::Send ^/ ; Comment / Uncomment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment