From 6c1e48b622a1fa5c52ae54f70eaa8f7a4cfce2d1 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 27 Apr 2022 19:17:29 +0100 Subject: [PATCH] Use groups to apps with similar keybindings --- macOS.ahk | 70 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/macOS.ahk b/macOS.ahk index 1d7f3d1..967d88c 100644 --- a/macOS.ahk +++ b/macOS.ahk @@ -4,6 +4,12 @@ SendMode Input SetWorkingDir %A_ScriptDir% SetTitleMatchMode 2 +GroupAdd, Browser, Firefox + +GroupAdd, WebCatalog, Personal +GroupAdd, WebCatalog, Apple +GroupAdd, WebCatalog, Work + ; ---------------------------------- Editing --------------------------------- !x:: ; cut send ^x @@ -36,7 +42,7 @@ send ^a return $!r:: ; reload -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^r else send !r @@ -46,7 +52,7 @@ return $![:: ; back from Alt+[ $<^>![:: ; from AltGr+[ -if WinActive("Firefox") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send !{Left} else send ![ @@ -54,14 +60,14 @@ return $!]:: ; forward from Atl+] $<^>!]:: ; from AltGr+] -if WinActive("Firefox") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send !{Right} else send !] return $!+r:: ; reload (override cache) -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+r else send !+r @@ -69,42 +75,42 @@ return ; ------------------------------- Current Page ------------------------------- $!Down:: ; go to bottom of page -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^{Down} else send !{Down} return $!Up:: ; go to top of page -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^{Up} else send !{Up} return $!p:: ; print -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^p else send !p return $!+=:: ; zoom in -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+= else send !+= return $!-:: ; zoom out -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^- else send !- return $!0:: ; zoom reset -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^0 else send !0 @@ -112,14 +118,14 @@ return ; ---------------------------------- Search ---------------------------------- $!f:: ; find -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^f else send !f return $!l:: ; focus address bar -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^l else send !l @@ -127,27 +133,27 @@ return ; ------------------------------ Windows & Tabs ------------------------------ $!w:: ; close tab -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^w else send !w return !<#w:: ; close window - the fuck is this? -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+w ; TODO: else return !q:: ; quit -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+q else send !{F4} return $!+[:: ; go one tab left -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^{PgUp} else if WinActive("ahk_exe WindowsTerminal.exe") send ^+{Tab} @@ -156,7 +162,7 @@ else return $!+]:: ; go one tab right -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^{PgDn} else if WinActive("ahk_exe WindowsTerminal.exe") send ^{Tab} @@ -165,105 +171,105 @@ else return $^!+[:: ; move one tab left -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+{PgUp} else send ^!+[ return $^!+]:: ; move one tab right -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+{PgDn} else send ^!+] return $!t:: ; new tab -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^t else send !t return $!n:: ; new window -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^n else send !n return $!+n:: ; new private window -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+p else send !+n return $!+t:: ; undo closed tab -if WinActive("Firefox") +if WinActive("ahk_group Browser") send ^+t else send !+t return $!1:: ; select tab 1 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^1 else send !1 return $!2:: ; select tab 2 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^2 else send !2 return $!3:: ; select tab 3 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^3 else send !3 return $!4:: ; select tab 4 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^4 else send !4 return $!5:: ; select tab 5 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^5 else send !5 return $!6:: ; select tab 6 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^6 else send !6 return $!7:: ; select tab 7 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^7 else send !7 return $!8:: ; select tab 8 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^8 else send !8 return $!9:: ; select tab 9 -if WinActive("Firefox") || WinActive("Ferdi") || WinActive("Personal") +if WinActive("ahk_group Browser") || WinActive("ahk_group WebCatalog") send ^9 else send !9