-
Notifications
You must be signed in to change notification settings - Fork 1
/
0 Hyper.ahk
182 lines (170 loc) · 8.43 KB
/
0 Hyper.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#Requires AutoHotKey 2.1-alpha.4
; remap capslock to hyper if capslock is toggled, remap it to esc
SetCapsLockState "AlwaysOff" ;[CapsLock] disable
#HotIf !WinActive("ahk_group Games") ; disable in Games
class c⇪ {
static _ := 0
, ↑ := 1
, 🕐↓ := 0
}
Capslock::{ ; set time of the first down event to track when hold duration
if c⇪.↑ {
c⇪.🕐↓ := A_TickCount
c⇪.↑ := 0
}
}
Capslock Up::{ ; ~not fire a hotkey until it's released
c⇪.↑ := 1
; ↓ not needed? DownTemp=Down except for ⇧◆⎇⎈, where it tells subsequent sends that the key is not permanently down, and may be released whenever a keystroke calls for it: Send {Ctrl DownTemp}, Send {Left} ⟶ ←, not ⎈← keystroke
; SendInput '{Ctrl DownTemp}{Shift DownTemp}{Alt DownTemp}{LWin DownTemp}'
; SendInput '{Ctrl Up}{Shift Up}{Alt Up}{LWin Up}'
if (A_PriorKey = "Capslock") { ;⇪ vk14 ⟶ k (vk4B) Run Keypirinha on single ⇪ press
if (c⇪.🕐Δ := A_TickCount - c⇪.🕐↓) < 500 {
SendInput '^+!#{vk4B}'
}
} ; if '~' is applied to a custom modifier key (prefix key) which is also used as its own hotkey, that hotkey will fire when the key is pressed instead of being delayed until the key is released
c⇪.🕐↓ := 0
}
#vk14::{ ;◆⇪ vk14 ⟶ Activate CapsLock
if GetKeyState("vk14","T") = 1 {
SetCapsLockState "AlwaysOff"
} else {
SetCapsLockState "AlwaysOn"
}
}
+CapsLock::{ ;[+⇪] to ^⇧⌥L to launch/activate Listary
if ProcessExist("Listary.exe") {
SendInput '{Ctrl Down}{Shift Down}{Alt Down}{l}{Ctrl Up}{Shift Up}{Alt Up}' ;[l] vk4C SC026
} else {
SendInput '{LShift Down}' ; Replace CapsLock with Shift
}
}
;CapsLock Up::SendInput '{LShift Up}' ;[CapsLock] replace with Shift, second part (if no Launcher running)
;CapsLock:: ;⇪ to ^⇧⌥K to launch/activate Keypirinha
; If ProcessExist("keypirinha-x64.exe") {
; SendInput '{Ctrl Down}{Shift Down}{Alt Down}{vk4B}{Ctrl Up}{Shift Up}{Alt Up}' ;[k] vk4B SC025
; ;SendInput '{Alt Down}{Space}{Alt Up}'
; ;vk14::SendInput '{Alt Down}{Space Down}{Space Up}{Alt Up}'
; ;vk14::SendInput '{Alt Down}{Space Down}'
; ;vk14 up::SendInput '{Alt Up}{Space Up}'
; } Else {
; SendInput '{LShift Down}' ; Replace CapsLock with Shift
; }
; Return
; ^CapsLock::{ ;[^⇪] to ^⇧⌥W to launch/activate Wox
; if ProcessExist("Wox.exe") {
; SendInput '{Ctrl Down}{Shift Down}{Alt Down}{w}{Ctrl Up}{Shift Up}{Alt Up}' ;vk57
; } else {
; SendInput '{LShift Down}' ; Replace CapsLock with Shift
; }
; }
; On [CapsLock] key press/release --> trigger Wox launcher through [Alt]+[Space]
; "Hyperkey" bindings
;CapsLock & l::SendInput(GetKeyState("Shift", "P") ? '{F2}' : '$') ;[l] vk4C SC026
;CapsLock & k::
; if GetKeyState("Shift", "P")
; Send('{F2}')
; else
; Send('$')
; Return
~CapsLock & vk57::RunActivMin(AppWire) ;⇪w vk57 ⟶ Run App
~CapsLock & vk45::RunActivMin(App.ST*) ;⇪e vk45 ⟶ Run App
~CapsLock & vk52::RunActivMin(App.VivaldiX*) ;⇪r vk52 ⟶ Run App
~CapsLock & vk54::Run('"' AppWezTerm '"') ;⇪t vk54 ⟶ Run App
~CapsLock & vk56::RunActivMin(AppVivaldi) ;⇪v vk56 ⟶ Run App
~CapsLock & vk51::RunActivMin(App.DOpus*) ;⇪q vk51 ⟶ Run App
~CapsLock & vk44::RunActivMin(App.DOpus*) ;⇪d vk44 ⟶ Run App
~CapsLock & vk46::RunActivMin(App.DOpus*) ;⇪f vk46 ⟶ Run App
~CapsLock & vk53::RunActivMin(App.Everything*) ;⇪s vk53 ⟶ Run App
~CapsLock & vk43::RunActivMin(AppWezTerm) ;⇪c vk43 ⟶ Run App
~CapsLock & vk58::RunActivMin(AppExcel) ;⇪x vk58 ⟶ Run App
; ~CapsLock & vk43::RunActivMin(AppConEmu) ;⇪c vk43 ⟶ Run App
; ~CapsLock & vk54::Run('"' AppConEmu '"') ;⇪t vk54 ⟶ Run App
; Toggle Window Title Bar ()
; ~CapsLock & vkBD::WinSetStyle("-" WS_Borderless, "A") ;⇪- vkBD ⟶ Window Title Bar Off
; ~CapsLock & vkBB::WinSetStyle("+" WS_Borderless, "A") ;⇪= vkBB ⟶ Window Title Bar On
~CapsLock & vkBD::{
if (⇧↓ := GetKeyState('LShift','P')) {
Win_TitleToggle(FixPos:=0,,"-") ;⇪- vkBD ⟶ Window Title Bar Off
} {
Win_TitleToggle(FixPos:=1,,"-") ;⇪- vkBD ⟶ Window Title Bar Off
}
}
~CapsLock & vkBB::{
if (⇧↓ := GetKeyState('LShift','P')) {
Win_TitleToggle(FixPos:=0,,"+") ;⇪= vkBB ⟶ Window Title Bar On
} {
Win_TitleToggle(FixPos:=1,,"+") ;⇪= vkBB ⟶ Window Title Bar On
}
}
; Navigation
~CapsLock & Left:: SendInput '^+{Tab}' ;⇪← vk25 ⟶ ^⇧⭾ Tab Left
~CapsLock & Right:: SendInput '^{Tab}' ;⇪→ vk27 ⟶ ^⭾ Tab Rigth
; Cursor
~CapsLock & vk4A:: SendInput '{Blind}{Down}' ;⇪j vk4A ⟶ ← Arrow Down (with mods)
~CapsLock & vk4B:: SendInput '{Blind}{Up}' ;⇪k vk4B ⟶ → Arrow Up (with mods)
~CapsLock & vk4C:: SendInput '{Blind}{Left}' ;⇪l vk4C ⟶ ↑ Arrow Left (with mods)
~CapsLock & vkBA:: SendInput '{Blind}{Right}' ;⇪; vkBA ⟶ ↓ Arrow Right (with mods)
~CapsLock & vk4D:: SendInput '{Blind}{PgDn}' ;⇪m vk4D ⟶ ⇟ Page Down (with mods)
~CapsLock & vkBC:: SendInput '{Blind}{PgUp}' ;⇪, vkBC ⟶ ⇞ Arrow Up (with mods)
; ~CapsLock & vk4A:: SendInput '{Blind}{Left}' ;⇪j vk4A ⟶ ← Arrow Left (with mods)
; ~CapsLock & vk4B:: SendInput '{Blind}{Down}' ;⇪k vk4B ⟶ → Arrow Down (with mods)
; ~CapsLock & vk4C:: SendInput '{Blind}{Up}' ;⇪l vk4C ⟶ ↑ Arrow Up (with mods)
; ~CapsLock & vkBA:: SendInput '{Blind}{Right}' ;⇪; vkBA ⟶ ↓ Arrow Right (with mods)
; not sure why this is needed and how it's different from the much simpler {Blind} mode
; ~CapsLock & vk4A:: cursorKey("{Left}") ;⇪j vk4A ⟶ ← Arrow Left (with mods)
; ~CapsLock & vk4B:: cursorKey("{Down}") ;⇪k vk4B ⟶ → Arrow Down (with mods)
; ~CapsLock & vk4C:: cursorKey("{Up}") ;⇪l vk4C ⟶ ↑ Arrow Up (with mods)
; ~CapsLock & vkBA:: cursorKey("{Right}") ;⇪; vkBA ⟶ ↓ Arrow Right (with mods)
cursorKey(Arrow:="{Left}") {
if GetKeyState("Shift","P") and GetKeyState("Ctrl","P") and GetKeyState("Alt","P") {
SendInput '+^!' Arrow
} else if GetKeyState("Shift","P") and GetKeyState("Ctrl","P") {
SendInput '+^' Arrow
} else if GetKeyState("Shift","P") and GetKeyState("Alt","P") {
SendInput '+!' Arrow
} else if GetKeyState("Ctrl","P") and GetKeyState("Alt","P") {
SendInput '^!' Arrow
} else if GetKeyState("Shift","P") {
SendInput '+' Arrow
} else if GetKeyState("Ctrl","P") {
SendInput '^' Arrow
} else if GetKeyState("Alt","P") {
SendInput '!' Arrow
} else {
SendInput Arrow
}
}
; Popular hotkeys
; ~CapsLock & c:: SendInput '{Ctrl}{c}' ;[⇪c] vk43 SC02E
; ~CapsLock & v:: SendInput '{Ctrl}{v}' ;[⇪v] vk56 SC02F
#HotIf
;;; Check this alternative impelementation from KB-Caps-Nav.ahk
; or this autohotkey.com/boards/viewtopic.php?f=76&t=83471
; $Capslock::
; Gui, 93:+Owner ; prevent display of taskbar button
; Gui, 93:Show, y-99999 NA, "Enable nav-hotkeys: jikl"
; SendInput {LCtrl Down}
; KeyWait "Capslock" ; wait until the Capslock button is released
; Gui, 93:Cancel
; Send '{LCtrl Up}'
; Return
; #HotIf WinExist("Enable nav-hotkeys: jikl")
; *j::SendInput '{Blind}{LCtrl Up}{Left}{LCtrl Down}'
; *i::SendInput '{Blind}{LCtrl Up}{Up}{LCtrl Down}'
; *k::SendInput '{Blind}{LCtrl Up}{Down}{LCtrl Down}'
; *l::SendInput '{Blind}{LCtrl Up}{Right}{LCtrl Down}'
; #HotIf ; end context-sensitive block
/*
; Alternatives
SendInput '{Ctrl Down}{Shift Down}{Alt Down}{vk4B}{Ctrl Up}{Shift Up}{Alt Up}' ;[k] vk4B SC025
; Keypirinha.ini sets `hotkey_run = Ctrl+Shift+Win+Alt+Space`
SendInput '{Ctrl Down}{Shift Down}{LWin Down}{Alt Down}{vk20}{Ctrl Up}{Shift Up}{LWin Up}{Alt Up}' ;[ ](space) vk20 SC039
; Keypirinha.ini sets `hotkey_run = Ctrl+Shift+Win+Alt+K`
SendInput '{Ctrl Down}{Shift Down}{LWin Down}{Alt Down}{vk4B}{Ctrl Up}{Shift Up}{LWin Up}{Alt Up}' ;[k] vk4B SC025
SendInput '{Ctrl}{Shift}{Alt}{vk20}'
SendInput '{Ctrl}{Shift}{Alt}{vk4B}'
SendInput '+^#!{vk20}'
SendInput '{vk4B}' ;
SendInput '{Esc}'
*/