-
Notifications
You must be signed in to change notification settings - Fork 0
/
karabiner.edn
238 lines (213 loc) · 10.7 KB
/
karabiner.edn
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
{
:profiles {
:goku {
:default true
:alone 300 ; hold for .. ms to register single tap
:held 50 ; not sure what it's for
:delay 0 ; time after which the key press is delayed
:sim 30}} ; keys need to be pressed within this threshold to be considered simultaneous
:templates {
:open "open -a \"%s.app\""
:uri "open -g \"%s\""
:set-win "open -g rectangle://execute-action?name=%s"
:dncp "~/.bin/dnc-post \"%s\""}
:applications {
:xcode ["^com\\.apple\\.dt\\.Xcode$"]
:kitty ["^net\\.kovidgoyal\\.kitty$"]
:synapse ["^com\\jannis\\.synapse$"]
:safari ["^com\\.apple\\.Safari$"]
:citrix ["com.citrix.receiver.icaviewer.mac"]}
:modifiers {
:any {:optional [:fn :left_command :left_control :left_option :left_shift]}}
:simlayers {
:char-l {:key :a} :char-r {:key :semicolon}
:ctrl-l {:key :q} :ctrl-r {:key :p}
:numbers {:key :z :modi {:optional :any}}
:gui {:key :slash}}
:main [
; --------------------------------------------------------------------------
; thumb keys ---------------------------------------------------------------
{:des "thumb keys" :rules [
[:##spacebar :left_shift nil {:alone [:spacebar]}]
[:right_command :right_command :kitty {:alone :!Ch}]
[:right_command :right_command :!kitty {:alone [:open "kitty"]}]
[:left_command :left_command [["kVNormal" 0]] {:alone [:!CFf7]}]
[:left_command :left_command [["kVNormal" 1]] {:alone [:a [:!CFf7]]}]
[:left_option :left_option ["language" 0] {:alone [["language" 1]] :delayed {:invoked ["language" 0]} :params {:delay 500}}]
[:left_option :left_option ["language" 1] {:alone [["language" 2]] :delayed {:invoked ["language" 0]} :params {:delay 500}}]
]}
; --------------------------------------------------------------------------
; combo keys ---------------------------------------------------------------
{:des "home row combos: sd > tab, df > backspace, jk > escape/normal, kl > return" :rules [
[{:sim [:s :d] :modi :any} :tab]
[{:sim [:d :f] :modi :any} :delete_or_backspace]
[{:sim [:j :k] :modi :any} :escape]
[{:sim [:k :l] :modi :any} :return_or_enter]
]}
{:des "upper row combos: we > up, er > right, yu > scrolla (CFf9), ui > ctrl+u, io > switch tabs / ctrl+o" :rules [
[{:sim [:w :e] :modi :any} :up_arrow]
[{:sim [:e :r] :modi :any} :right_arrow]
[{:sim [:y :u] :modi :any} :!CFf9]
:kitty
[{:sim [:u :i] :modi :any} :!Tu]
[{:sim [:i :o] :modi :any} :!To]
:safari
[{:sim [:i :o] :modi :any} [:uri "synapse://openPanel?query=t%20"]]
:xcode
[{:sim [:i :o] :modi :any} :!CSo]
]}
{:des "lower row combos: xc > left, cv > down, m, > tab left ,. > tab right" :rules [
[{:sim [:x :c] :modi :any} :left_arrow]
[{:sim [:c :v] :modi :any} :down_arrow]
[:condis :!kVNormal :!inWooshy :!xcode]
[{:sim [:m :comma] :modi :any} :!TStab]
[{:sim [:comma :period] :modi :any} :!Ttab]
[:condis :kVNormal :!xcode]
[{:sim [:m :comma] :modi :any} [:a :!TStab :escape]]
[{:sim [:comma :period] :modi :any} [:a :!Ttab :escape]]
[:condis :inWooshy :!xcode]
[{:sim [:m :comma] :modi :any} [:!CFf8 :!TStab :!CFf8]]
[{:sim [:comma :period] :modi :any} [:!CFf8 :!Ttab :!CFf8]]
[:condis :!kVNormal :!inWooshy :xcode]
[{:sim [:m :comma] :modi :any} :!CSopen_bracket]
[{:sim [:comma :period] :modi :any} :!CSclose_bracket]
[:condis :kVNormal :xcode]
[{:sim [:m :comma] :modi :any} [:a :!CSopen_bracket :escape]]
[{:sim [:comma :period] :modi :any} [:a :!CSclose_bracket :escape]]
[:condis :inWooshy :!xcode]
[{:sim [:m :comma] :modi :any} [:!CFf8 :!CSopen_bracket :!CFf8]]
[{:sim [:comma :period] :modi :any} [:!CFf8 :!CSclose_bracket :!CFf8]]
]}
; --------------------------------------------------------------------------
; mouse --------------------------------------------------------------------
{:des "mouse mode" :rules [
[:condis :!kitty :!inWooshy]
; activation
[{:sim [:u :i] :modi :any} :!CFf8]
:inWooshy
; persistent wooshy ---------------------------------------------------
; [{:sim [:k :l] :modi :any} :return_or_enter nil {:delayed {:invoked :!Qf8} :params {:delay 200}}]
; [:##return_or_enter :return_or_enter nil {:delayed {:invoked :!Qf8} :params {:delay 200}}]
; menu bar ------------------------------------------------------------
; close & reopen wooshy to refresh, seems there's a bug in karabiner
; so we have to use right command on reactivation
[:!Cm [:!CFf8 [:uri "hammerspoon://showMenubar"]] nil {:delayed {:invoked :!Qf8} :params {:delay 600}}]
; make sure menubar hides when we close wooshy
[{:sim [:u :i] :modi :any} [:!CFf8 [:uri "hammerspoon://hideMenubar"]]]
; misc ----------------------------------------------------------------
; refresh
[:!Cr :!CFf8 nil {:delayed {:invoked :!CFf8} :params {:delay 100}}]
; scroll mode (scrolla)
; [:##spacebar :!CFf9 nil {:afterup :!CFf8 :alone :spacebar}]
:inScrolla
[:b :!Sg]
[:g [:g :g]]
]}
; --------------------------------------------------------------------------
; layers -------------------------------------------------------------------
{:des "character layer" :rules [
:char-l
; upper row
[:q :vk_none] [:w :!Sgrave_accent_and_tilde] [:e :grave_accent_and_tilde] [:r :!S6] [:t :!S4]
[:y :!S3] [:u :!S8] [:i :open_bracket] [:o :close_bracket] [:p :vk_none]
; home row
[:s :!Squote] [:d :quote] [:f :!Sbackslash] [:g :backslash]
[:h :!S5] [:j :hyphen] [:k :!S9] [:l :!S0]
; bottom row
[:z :vk_none] [:x :!Sequal_sign] [:c :equal_sign] [:v :!S1] [:b :!S2]
[:n :!S7] [:m :!Shyphen] [:comma :!Sopen_bracket] [:period :!Sclose_bracket] [:slash :vk_none]
:char-r
; upper row
[:q :vk_none] [:w :!Sgrave_accent_and_tilde] [:e :grave_accent_and_tilde] [:r :!S6] [:t :!S4]
[:y :!S3] [:u :!S8] [:i :open_bracket] [:o :close_bracket] [:p :vk_none]
; home row
[:s :!Squote] [:d :quote] [:f :!Sbackslash] [:g :backslash]
[:h :!S5] [:j :hyphen] [:k :!S9] [:l :!S0]
; bottom row
[:z :vk_none] [:x :!Sequal_sign] [:c :equal_sign] [:v :!S1] [:b :!S2]
[:n :!S7] [:m :!Shyphen] [:comma :!Sopen_bracket] [:period :!Sclose_bracket] [:slash :vk_none]
]}
{:des "number layer" :rules [
:numbers
; right half
[:y :vk_none] [:u :7] [:i :8] [:o :9] [:p :vk_none]
[:h :vk_none] [:j :4] [:k :5] [:l :6] [:semicolon :vk_none]
[:n :0] [:m :1] [:comma :2] [:period :3] [:slash :vk_none]
; left half disabled
[:q :vk_none] [:w :vk_none] [:e :vk_none] [:r :vk_none] [:t :vk_none]
[:a :vk_none] [:s :vk_none] [:d :vk_none] [:f :vk_none] [:g :vk_none]
[:x :vk_none] [:c :vk_none] [:v :vk_none] [:b :vk_none]
]}
{:des "gui layer" :rules [
:gui
; left half window sizing
[:e [:set-win "top-left"]] [:r [:set-win "next-display"]] [:t [:set-win "top-right"]]
[:d [:set-win "left-half"]] [:f [:set-win "maximize"]] [:g [:set-win "right-half"]]
[:c [:set-win "bottom-left"]] [:v [:set-win "previous-display"]] [:b [:set-win "bottom-right"]]
; left half others
[:q :vk_none] [:w :!C0]
[:a :!Cequal_sign] [:s :!Chyphen]
[:z :!Copen_bracket] [:x :!Cclose_bracket]
; right half disabled
[:y :vk_none] [:u :vk_none] [:i :vk_none] [:o :vk_none] [:p :vk_none]
[:h :vk_none] [:j :vk_none] [:k :vk_none] [:l :vk_none] [:semicolon :vk_none]
[:n :vk_none] [:m :vk_none] [:comma :vk_none] [:period :vk_none]
]}
{:des "extended control layer" :rules [
:ctrl-l
; upper row
[:w :!Tw] [:e :!Te] [:r :!Tr] [:t :!Tt]
[:y :!Ty] [:u :!Tu] [:i :!Ti] [:o :!To :!xcode] [:p :!Tp]
; home row
[:a :!Ta] [:s :!Ts] [:d :!Td :kitty] [:d :!Cw :!kitty] [:f :!Tf] [:g :!Tg]
[:h :left_arrow] [:j :down_arrow] [:k :up_arrow] [:l :right_arrow]
; bottom row
[:z :!Tz] [:x :!Tx] [:c :!Tc] [:v :!Tv] [:b :!Tb]
[:n :!Tn] [:m :!Tm] [:comma :!Tcomma] [:period :!Tperiod] [:slash [:!Sgrave_accent_and_tilde :slash :!Shyphen :slash]]
:ctrl-r
; upper row
[:q :!Tq] [:w :!Tw] [:e :!Te] [:r :!Tr] [:t :!Tt]
[:y :!Ty] [:u :!Tu] [:i :!Ti] [:o :!To :!xcode]
; home row
[:a :!Ta] [:s :!Ts] [:d :!Td :kitty] [:d :!Cw :!kitty] [:f :!Tf] [:g :!Tg]
[:h :left_arrow] [:j :down_arrow] [:k :up_arrow] [:l :right_arrow]
; bottom row
[:z :!Tz] [:x :!Tx] [:c :!Tc] [:v :!Tv] [:b :!Tb]
[:n :!Tn] [:m :!Tm] [:comma :!Tcomma] [:period :!Tperiod] [:slash [:!Sgrave_accent_and_tilde :slash :!Shyphen :slash]]
]}
; --------------------------------------------------------------------------
; languages ----------------------------------------------------------------
{:des "language character layers" :rules [
; german
[:condis ["language" 1]]
[:s [:!Os ["language" 0]]]
[:a [:!Ou :a ["language" 0]]] [:!Sa [:!Ou :!Sa ["language" 0]]]
[:o [:!Ou :o ["language" 0]]] [:!So [:!Ou :!So ["language" 0]]]
[:u [:!Ou :u ["language" 0]]] [:!Su [:!Ou :!Su ["language" 0]]]
; spanish
[:condis ["language" 2]]
[:n [:!On :n ["language" 0]]] [:!Sn [:!On :!Sn ["language" 0]]]
[:a [:!Oe :a ["language" 0]]] [:!Sa [:!Oe :!Sa ["language" 0]]]
[:e [:!Oe :e ["language" 0]]] [:!Se [:!Oe :!Se ["language" 0]]]
[:i [:!Oe :i ["language" 0]]] [:!Si [:!Oe :!Si ["language" 0]]]
[:o [:!Oe :o ["language" 0]]] [:!So [:!Oe :!So ["language" 0]]]
[:u [:!Oe :u ["language" 0]]] [:!Su [:!Oe :!Su ["language" 0]]]
]}
{:des "caps > escape / control s (kitty), held > control" :rules [
[:##caps_lock :left_control [:!kitty :!citrix] {:alone [:escape]}]
[:##caps_lock :left_control :kitty {:alone [:!Ts]}]
[:##caps_lock :left_control :citrix {:alone [:!Ts]}]
]}
; --------------------------------------------------------------------------
; kV mods ------------------------------------------------------------------
{:des "normal mode Y > y$" :rules [
[:condis ["kVNormal" 1]]
[:!Sy [:y :!S4]]
]}
{:des "safari normal mode" :rules [
[:condis :safari ["kVNormal" 1]]
[:q :!Ct]
[:period :!Cl]
]}
]
}