-
Notifications
You must be signed in to change notification settings - Fork 2
/
karabiner.edn
816 lines (798 loc) · 37.2 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
{
:profiles {
:goku {
:default true
:sim 200 ; keys need to be pressed within this threshold to be considered simultaneous
:simlayer-threshold 250 ; ???????
:alone 250 ; hold for 495ms and single tap registered; hold for 505ms and seen as modifier
:delay 300 ; time after which the key press is count delayed
:held 450 ; key is fired twice when 1000 ms is elapsed (otherwise seen as a hold command)
}
}
:devices {
:velocifire [{:vendor_id 1452 :product_id 591}]
}
:templates {
:open_social "/Users/grn/bin/open_social %s"
:open "osascript -e 'tell application \"%s\" to activate'"
:showhide "osascript -e '
global isVisible
set isVisible to visible of process \"%s\"
set isVisible to not isVisible
set visible of process \"%s\" to isVisible
'"
:go_to_url "osascript -e 'open location \"%s\"'"
:zcode "/Users/grn/bin/gui.py &"
; send keystrokes
:type "osascript -e 'tell application \"System Events\" to keystroke \"%s\"'"
; send keystrokes and press enter
:type_cr "
osascript -e 'tell application \"System Events\" to keystroke \"%s\"';
osascript -e 'tell application \"System Events\" to keystroke return';"
:paste "osascript -e '
global storedClipboard
set storedClipboard to the clipboard
set the clipboard to \"%s\"
set the clipboard to the clipboard + \"%s\"
tell application \"System Events\"
keystroke \"v\" using command down
end tell
delay 0.1
set the clipboard to storedClipboard
'"
:is_in_gdoc "osascript -e '
global frontApp, window_name, theURL
tell application \"System Events\"
set frontApp to name of first application process whose frontmost is true
end tell
if frontApp equals \"Safari\" then
tell application \"Safari\"
set theURL to URL of current tab of window 1
end tell
if theURL contains \"https://docs.google.com/spreadsheets\" then
do shell script \"/Users/grn/bin/in-gdoc.sh\"
end if
end if'"
:sleep "sleep %s" ; sample placeholder
}
:applications {
; extract from /Applications/$APP/Contents/Info.plist from 'CFBundleIdentifier' key
:arc [ "^company.thebrowser.Browser" ]
:chrome [ "^com.google.Chrome$" ]
:discord [ "^com.hnc.Discord" ]
:drafts [ "^com.agiletortoise.Drafts-OSX$" ]
:emacs [ "^org.gnu.Emacs$" ]
:evernote [ "^com.evernote.Evernote$" ]
:finder [ "^com.apple.finder" ]
:firefox [ "^org.mozilla.firefox$" ]
:goodnotes [ "^com.goodnotesapp.x$" ]
:kitty [ "net.kovidgoyal.kitty" ]
:mailmate [ "^com.freron.MailMate$"]
:messages [ "^com.apple.MobileSMS" ]
:obsidian [ "^md.obsidian" ]
:opera [ "^com.operasoftware.Opera$" ]
:safari [ "^com.apple.Safari$" ]
:slack [ "^com.tinyspeck.slackmacgap" ]
:stickies [ "^com.apple.Stickies" ]
:teams [ "^com.microsoft.teams" ]
:telegram [ "^ru.keepcoder.Telegram" ]
:vscode [ "^com.microsoft.VSCode$" ]
:vivaldi [ "^com.vivaldi.Vivaldi$" ]
:vlc [ "^org.videolan.vlc" ]
:workflowy [ "^com.workflowy.desktop" ]
:zoom [ "^us.zoom.xos$" ]
}
:froms {
:any_key {:any :key_code}
:any_consumer {:any :consumer_key_code }
:any_button {:any :pointing_button}
;alias
:delete {:key :delete_or_backspace}
:return {:key :return_or_enter}
:btick {:key :grave_accent_and_tilde}
:tilde {:key :grave_accent_and_tilde}
:bslash {:key :backslash}
:ls {:key :left_shift}
:rs {:key :right_shift}
;colemak froms (for easier mnemonics)
:-q {:key :q}
:-w {:key :w}
:-f {:key :e}
:-p {:key :r}
:-g {:key :t}
:-j {:key :y}
:-l {:key :u}
:-u {:key :i}
:-y {:key :o}
:-semicolon {:key :p}
:-a {:key :a}
:-r {:key :s}
:-s {:key :d}
:-t {:key :f}
:-d {:key :g}
:-h {:key :h}
:-n {:key :j}
:-e {:key :k}
:-i {:key :l}
:-o {:key :semicolon}
:-z {:key :grave_accent_and_tilde}
:-x {:key :z}
:-c {:key :x}
:-v {:key :c}
:-b {:key :v}
:-k {:key :n}
:-m {:key :m}
}
:tos {
;colemak tos (for easier string sending)
:-q {:key :q}
:-w {:key :w}
:-f {:key :e}
:-p {:key :r}
:-g {:key :t}
:-j {:key :y}
:-l {:key :u}
:-u {:key :i}
:-y {:key :o}
:-semicolon {:key :semicolon}
:-a {:key :a}
:-r {:key :s}
:-s {:key :d}
:-t {:key :f}
:-d {:key :g}
:-h {:key :h}
:-n {:key :j}
:-e {:key :k}
:-i {:key :l}
:-o {:key :semicolon}
:-z {:key :grave_accent_and_tilde}
:-x {:key :z}
:-c {:key :x}
:-v {:key :c}
:-b {:key :v}
:-k {:key :n}
:-m {:key :m}
;named symbols
:exclaim {:key :1 :modi :shift}
:at {:key :2 :modi :shift}
:hash {:key :3 :modi :shift}
:dollar {:key :4 :modi :shift}
:percent {:key :5 :modi :shift}
:caret {:key :6 :modi :shift}
:ampersand {:key :7 :modi :shift}
:bullet {:key :8 :modi :shift}
:open_paren {:key :9 :modi :shift}
:close_paren {:key :0 :modi :shift}
:hyphen {:key :hyphen}
:underscore {:key :hyphen :modi :shift}
:equal {:key :equal_sign}
:plus {:key :equal_sign :modi :shift}
:semicolon {:key :semicolon}
:colon {:key :semicolon :modi :shift}
:open_bracket {:key :open_bracket}
:close_bracket {:key :close_bracket}
:open_brace {:key :open_bracket :modi :shift}
:close_brace {:key :close_bracket :modi :shift}
:less_than {:key :comma :modi :shift}
:greater_than {:key :period :modi :shift}
:backquote {:key :grave_accent_and_tilde}
:tilde {:key :grave_accent_and_tilde :modi :shift}
:dquote {:key :quote :modi :shift}
:pipe {:key :backslash :modi :shift}
:question {:key :slash :modi :shift}
:ls {:key :left_shift}
:rs {:key :right_shift}
; system-wide shortcuts
:command_tab {:key :!Ctab}
:left_desktop {:key :!!left_arrow}
:right_desktop {:key :!!right_arrow}
:mission_control {:key :!!up_arrow}
:internet_query {:key :!!t}
:show_application_windows {:key :!!down_arrow}
:show_desktop {:key :f12}
:activate_spotlight {:key :!!spacebar}
:fullscreen_snapshot {:key :!CS3}
:window_snapshot {:key :!CS4}
:selection_snapshot {:key :!CS5}
:emoji_picker {:key :spacebar :modi [:control :command]} ;!CTspacebar
:system-new_tab {:key :!Ct}
:system-close_tab {:key :!Cw}
:system-force_quit_apps {:key :!COescape}
; 1password
:activate_1password {:key :!COTspacebar}
; chrome
:chrome-prev_tab {:key :!TStab}
:chrome-next_tab {:key :!Ttab}
:chrome-toggle_reader {:key :!CSr}
; drafts
:drafts-toggle_onoff {:key :!!return_or_enter}
:drafts-beginning_of_line {:key :!Cleft_arrow}
:drafts-end_of_line {:key :!Cright_arrow}
:drafts-toggle_draft_list {:key :!C1}
; emacs
; evernote
:evernote-beginning_of_line {:key :!Cleft_arrow}
:evernote-end_of_line {:key :!Cright_arrow}
; hazeover - focus on one window
:activate_hazeover {:key :!!f6}
; kitty
:kitty-prev_tab {:key :!Cleft_arrow}
:kitty-next_tab {:key :!Cright_arrow}
:kitty-move_tab_left {:key :!COleft_arrow}
:kitty-move_tab_right {:key :!COright_arrow}
:kitty-word_left {:key :!Tleft_arrow}
:kitty-word_right {:key :!Tright_arrow}
:kitty-beginning_of_line {:key :!Ta}
:kitty-end_of_line {:key :!Te}
:kitty-tmux_prefix {:key :!Ta}
; opera
:opera-prev_tab {:key :!COleft_arrow}
:opera-next_tab {:key :!COright_arrow}
; rectangle - window positioning
:window_resize_and_left {:key :!!j}
:window_resize_and_right {:key :!!l}
:window_resize_and_center {:key :!!k}
:window_full_size {:key :!!i}
:window_center {:key :!!semicolon}
; safari
:safari-prev_tab {:key :!TStab}
:safari-next_tab {:key :!Ttab}
:safari-hist_back {:key :!Copen_bracket}
:safari-hist_frwd {:key :!Cclose_bracket}
:safari-toggle_reader {:key :!CSr}
:safari-toggle_darkmode {:key :!COk}
:safari-close_tab {:key :!Cw}
; vscode
:toggle_terminal_or_editor {:key :!Tgrave_accent_and_tilde}
:toggle_terminal {:key :!COspacebar}
:focus_group_or_terminal_left {:key :!CTOup_arrow}
:focus_group_or_terminal_right {:key :!CTOdown_arrow}
:focus_editor_left {:key :!COleft_arrow}
:focus_editor_right {:key :!COright_arrow}
:focus_file_or_new_tab {:key :!Cp}
}
;; :simlayers {
;; :apprun {:key :grave_accent_and_tilde}
;; }
:main [
{
:des "Cmd+Option+Shift+Esc to Reset All Layers (when/if something goes horribly wrong)"
:rules [
[:!COTescape [
["blocked" 0] ["extend" 0], ["wm" 0], ["apprun" 0], ["colemak_unshifted" 0]
["qwerty" 0], ["capslock" 0], ["games" 0], ["layer" 0]
]]
]
}
{
:des "Toggle CapsLock w/ FN+CapsLock"
:rules [
[:!F#Pcaps_lock [:caps_lock [:noti :caps "Caps Lock"]["capslock" 1]] [["capslock" 0]["blocked" 0]]]
[:!F#Pcaps_lock [:caps_lock [:noti :caps ""]["capslock" 0]] [["capslock" 1]["blocked" 0]]]
]
}
{
:des "Rotate between Game Layer, QWERTY w/ layers and Karabiner Toggle w/ FN+LeftShift"
:rules [
[:!F#Pleft_shift [["blocked" 0]["qwerty" 0]["colemak_unshifted" 1]["layer" 1]["wm_off" 0][:noti :layers "Unshifted Colemak [Fn+LCtrl]"]]["layer" 0]]
[:!F#Pleft_shift [["blocked" 0]["qwerty" 1]["colemak_unshifted" 0]["layer" 2]["wm_off" 0][:noti :layers "QWERTY w/ layers [Fn+LCtrl]"]]["layer" 1]]
[:!F#Pleft_shift [["blocked" 1]["qwerty" 1]["colemak_unshifted" 0]["layer" 3]["wm_off" 1][:noti :layers "QWERTY w/ IJKL locked to arrows [Fn+LCtrl]"]]["layer" 2]]
[:!F#Pleft_shift [["blocked" 1]["qwerty" 1]["colemak_unshifted" 0]["layer" 4]["wm_off" 1][:noti :layers "Karabiner Disabled [Fn+LCtrl]"]]["layer" 3]]
[:!F#Pleft_shift [["blocked" 0]["qwerty" 0]["colemak_unshifted" 0]["layer" 0]["wm_off" 0][:noti :layers ""]]["layer" 4]]
]
}
{
:des "Games Layer"
:rules [
[:condi ["layer" 3]]
[:##i :up_arrow]
[:##k :down_arrow]
[:##j :left_arrow]
[:##l :right_arrow]
]
}
{
:des "AppRun Layer - hold Tab key to activate"
:rules [
[:tab ["apprun" 1] [:!fn_base :!fn_ctrl :!fn_optn :!fn_cmnd :!extend :!blocked :!qwerty] {:alone :tab :afterup ["apprun" 0]}]
:apprun
;; switch desktops
[:y :!!1]
[:u :!!2]
[:i :!!3]
[:o :!!4]
[:p :!!5]
[:open_bracket :!!6]
[:return_or_enter :!Fspacebar]
;; swap active browser
[:right_option ["browser" 0] ["browser" 1]]
[:right_option ["browser" 1] ["browser" 0]]
[:spacebar [:open "Safari"] ["browser" 0]]
[:spacebar [:open "Vivaldi"] ["browser" 1]]
[:right_command [:open "Vivaldi"] ["browser" 0]]
[:right_command [:open "Safari"] ["browser" 1]]
;; swap shift combos between tiled/stacked
[:left_option ["yabai_stack" 0] ["yabai_stack" 1]]
[:left_option ["yabai_stack" 1] ["yabai_stack" 0]]
;; keys acting on single apps
[:j [:open "Visual Studio Code"]]
[:n [:open "Kitty"]]
[:m [:open "Mailmate"]]
;; final cleanup
[:any_key :vk_none]
[:any_consumer :vk_none]
]
}
{
:des "Yabai Layers (uses Fn as base trigger)"
:rules [
[:fn ["fn_base" 1] nil {:afterup ["fn_base" 0] :alone :!Freturn_or_enter}]
[:condi :fn_base :!fn_ctrl :!fn_optn :!fn_cmnd]
[:caps_lock [:caps_lock [:noti :caps "Caps Lock"]["capslock" 1]] [["capslock" 0]["blocked" 0]]]
[:!Pcaps_lock [:caps_lock [:noti :caps ""]["capslock" 0]] [["capslock" 1]["blocked" 0]]]
[:left_shift [["blocked" 0]["qwerty" 0]["colemak_unshifted" 1]["layer" 1]["wm_off" 0][:noti :layers "Unshifted Colemak [Fn+LCtrl]"]]["layer" 0]]
[:left_shift [["blocked" 0]["qwerty" 1]["colemak_unshifted" 0]["layer" 2]["wm_off" 0][:noti :layers "QWERTY w/ layers [Fn+LCtrl]"]]["layer" 1]]
[:left_shift [["blocked" 1]["qwerty" 1]["colemak_unshifted" 0]["layer" 3]["wm_off" 1][:noti :layers "QWERTY w/ IJKL locked to arrows [Fn+LCtrl]"]]["layer" 2]]
[:left_shift [["blocked" 1]["qwerty" 1]["colemak_unshifted" 0]["layer" 4]["wm_off" 1][:noti :layers "Karabiner Disabled [Fn+LCtrl]"]]["layer" 3]]
[:left_shift [["blocked" 0]["qwerty" 0]["colemak_unshifted" 0]["layer" 0]["wm_off" 0][:noti :layers ""]]["layer" 4]]
[:left_control ["fn_ctrl" 1] nil {:afterup ["fn_ctrl" 0]}]
[:left_option ["fn_optn" 1] nil {:afterup ["fn_optn" 0]}]
[:left_command ["fn_cmnd" 1] nil {:afterup ["fn_cmnd" 0]}]
[:condi :fn_base :!fn_ctrl :!fn_optn :!fn_cmnd]
; shortcuts used by other things than Yabai
[:right_shift :!FSe]
;
[:e ["fn_cmnd" 1] nil {:afterup ["fn_cmnd" 0]}]
[:w ["fn_optn" 1] nil {:afterup ["fn_optn" 0]}]
[:1 :!F1]
[:2 :!F2]
[:3 :!F3]
[:7 :!F7]
[:8 :!F8]
[:9 :!F9]
[:0 :!F0]
[:z :!Fz]
[:x :!Fx]
[:c :!Fc]
[:u :!Fu]
[:o :!Fo]
[:i :!Fi]
[:j :!Fj]
[:k :!Fk]
[:l :!Fl]
[:r :!Fr]
[:p :!Fp]
[:f :!Ff]
[:n :!Fm]
[:open_bracket :!Fopen_bracket]
[:close_bracket :!Fclose_bracket]
[:comma :!Fcomma]
[:period :!Fperiod]
[:hyphen :!Fhyphen]
[:spacebar :!Fspacebar]
[:tab :!Ftab]
[:equal_sign :!Fequal_sign]
[:hyphen :!Fhyphen]
[:backslash :!Fbackslash]
[:return_or_enter :!Freturn_or_enter]
[:any_key :vk_none]
[:condi :fn_ctrl]
[:8 :!FT8]
[:9 :!FT9]
[:0 :!FT0]
[:i :!FTi]
[:j :!FTj]
[:k :!FTk]
[:l :!FTl]
[:any_key :vk_none]
[:condi :fn_optn]
[:8 :!FT8]
[:9 :!FT9]
[:0 :!FT0]
[:i :!FOi]
[:j :!FOj]
[:k :!FOk]
[:l :!FOl]
[:any_key :vk_none]
[:condi :fn_cmnd]
[:8 :!FT8]
[:9 :!FT9]
[:0 :!FT0]
[:i :!FCi]
[:j :!FCj]
[:k :!FCk]
[:l :!FCl]
[:any_key :vk_none]
]
}
{
:des "Kitty Layers"
:rules [
[:condi :fn_tmux]
[:i [:!Ta :up_arrow]]
[:j [:!Ta :left_arrow]]
[:k [:!Ta :down_arrow]]
[:l [:!Ta :right_arrow]]
[:any_key :vk_none]
[:condi :fn_nvim]
[:u :!Sb]
[:o :!Sw]
[:semicolon [:!Tw :o]]
[:i [:!Tw :up_arrow]]
[:j [:!Tw :left_arrow]]
[:k [:!Tw :down_arrow]]
[:l [:!Tw :right_arrow]]
[:comma [:type_cr ":bp"]]
[:period [:type_cr ":bn"]]
[:any_key :vk_none]
]
}
{
:des "Power Combos"
:rules [
[:condi :!blocked :!extend :!apprun]
[:return_or_enter nil nil {:alone :return_or_enter :held :!CTf}]
; Yabai: switch between apps in the stack OR tiled using shift
[:left_shift :left_shift ["yabai_stack" 0] {:alone :!Fj}]
[:right_shift :right_shift ["yabai_stack" 0] {:alone :!Fl}]
[:left_shift :left_shift ["yabai_stack" 1] {:alone :!Fcomma}]
[:right_shift :right_shift ["yabai_stack" 1] {:alone :!Fperiod}]
[:left_command :left_command nil {:alone :!Ctab}]
; global
[:##caps_lock :left_control nil {:alone :escape}]
[:f5 :!Fh] ; toggle show desktop
[:f6 :activate_hazeover] ; activate hazeover
[:!Th :delete_or_backspace]
[:!Sspacebar :spacebar]
; chrome
[:!Qleft_command [:!Ql :!Qv :return_or_enter] :chrome]
[:!Cright_command [:button2 :c :return_or_enter] :chrome]
[:right_command :right_command :chrome {:alone :chrome-toggle_reader}]
; discord
[:right_command :right_command :discord {:alone :!Cu}] ; toggle user list
; drafts
[:right_command :right_command :drafts {:alone [:!C1 :!COt :!CSt]}] ; make it look as basic as possible
[:right_option :right_option :drafts {:alone [:!Cbackslash :down_arrow :down_arrow :right_arrow]}]
[:left_option :left_option :drafts {:alone [:!CSbackslash]}]
[:!Cdelete_or_backspace :!CSOdelete_or_backspace :drafts]
; finder
[:right_command :right_command :finder {:alone :!CTs}]
; kitty
[:right_command :right_command [:kitty ["tmux_prefix" 0]] {:alone :!Ta}]
[:right_command :right_command [:kitty ["tmux_prefix" 1]] {:alone :!Tb}]
[:right_command :right_command [:vscode ["vscode_terminal" 0]] {:alone :toggle_terminal_or_editor}]
[:right_option :right_option [:kitty :!tmux_sync_panes] {:alone [:!Ta :!Ssemicolon [:type_cr "setw synchronize-panes on"] ["tmux_sync_panes" 1]]}]
[:right_option :right_option [:kitty :tmux_sync_panes] {:alone [:!Ta :!Ssemicolon [:type_cr "setw synchronize-panes off"] ["tmux_sync_panes" 0]]}]
; rotate between ctrl+a & ctrl+b as a tmux prefix
[:!Qspacebar ["tmux_prefix" 1] [:kitty ["tmux_prefix" 0]]]
[:!Qspacebar ["tmux_prefix" 0] [:kitty ["tmux_prefix" 1]]]
[:!Cf [:!Ta :c] :kitty] ; Cmd+T on Colemak
[:!Cw [:!Ta :k] :kitty]
[:!C0 [:!Ta :0] :kitty]
[:!C1 [:!Ta :1] :kitty]
[:!C2 [:!Ta :2] :kitty]
[:!C3 [:!Ta :3] :kitty]
[:!C4 [:!Ta :4] :kitty]
[:!C5 [:!Ta :5] :kitty]
[:!C6 [:!Ta :6] :kitty]
[:!C7 [:!Ta :7] :kitty]
[:!C8 [:!Ta :8] :kitty]
[:!C9 [:!Ta :9] :kitty]
[:!CSf :vk_none :kitty]
[:!Qf :!QSt :kitty]
[:!Q0 :!C0 :kitty]
[:!Q1 :!C1 :kitty]
[:!Q2 :!C2 :kitty]
[:!Q3 :!C3 :kitty]
[:!Q4 :!C4 :kitty]
[:!Q5 :!C5 :kitty]
[:!Q6 :!C6 :kitty]
[:!Q7 :!C7 :kitty]
[:!Q8 :!C8 :kitty]
[:!Q9 :!C9 :kitty]
; mailmate
[:right_command :right_command :mailmate {:alone :!COTd}]
[:right_option :right_option :mailmate {:alone :!COu}]
; obsidian
[:right_command :right_command :obsidian {:alone :!Ct}]
; opera
[:!Qspacebar :!COi :opera]
; safari
[:!CSf :vk_none :safari]
[:!Qf :!QSt :safari]
[:!Qleft_command [:!Cl :!Cv :return_or_enter] :safari]
[:!Cright_command [:button2 :c :return_or_enter] :safari]
[:left_control :left_control :safari {:alone :!CSbackslash}]
[:left_option :left_option :safari {:alone :!COk}] ; toggle dark mode
[:right_command :right_command :safari {:alone :!CT1}]
[:right_option :left_option :safari {:alone :!CSr}]
[:!Sright_command :safari-toggle_reader :safari]
[:!Qspacebar :!COi :safari]
; slack
[:right_command :right_command :slack {:alone :!CSd}]
; teams
[:left_option :left_option :teams {:alone :!CSm}] ; toggle microphone
; vivaldi
[:!CSf :vk_none :vivaldi]
[:!Qf :!QSt :vivaldi]
[:right_command :right_command :vivaldi {:alone :!COb}]
[:right_option :right_option :vivaldi {:alone :!COTn}]
;; [:right_option :left_option :vivaldi {:alone :!CSr}]
[:!Qspacebar :!COi :vivaldi]
; vlc
[:right_command :right_command :vlc {:alone :!COp}]
[:right_option :right_option :vlc {:alone :!C3}]
; vscode
; rotate between showing/hiding terminal, switching between them visible and maximized terminal
[:!Qspacebar ["vscode_terminal" 1] [:vscode ["vscode_terminal" 0]]]
[:!Qspacebar ["vscode_terminal" 2] [:vscode ["vscode_terminal" 1]]]
[:!Qspacebar ["vscode_terminal" 0] [:vscode ["vscode_terminal" 2]]]
; based on the variable above, work with terminal based on preference
[:right_command :right_command [:vscode ["vscode_terminal" 0]] {:alone :toggle_terminal_or_editor}]
[:right_command :right_command [:vscode ["vscode_terminal" 1]] {:alone :toggle_terminal}]
[:right_command :right_command [:vscode ["vscode_terminal" 2]] {:alone [:!COm :toggle_terminal]}]
[:!Creturn_or_enter :!TOn :vscode] ; run code
[:right_option :right_option :vscode {:alone :!Cb}] ; toggle side bar
[:left_option :left_option :vscode {:alone :!Tw}] ; switch to window
; workflowy
[:right_command :right_command :workflowy {:alone :!Cup_arrow}]
[:!Sright_command :!Sright_command :workflowy {:alone :!Cdown_arrow}]
[:right_option :right_option :workflowy {:alone :!Cslash}]
; zoom
[:right_option :right_option :zoom {:alone :!Oy}] ; toggle raised hand
[:right_command :right_command :zoom {:alone [:!Cu :!CSh]}] ; toggle participant list & chat
[:left_option :left_option :zoom {:alone :!CSa}] ; toggle microphone
[:!Cleft_option :!CSv :zoom] ; toggle video
[:!Qleft_option :!CSv :zoom] ; toggle video
[:!Qleft_command :!CSs :zoom] ; toggle sharing
]
}
{
:des "Extended Layer - Spacebar"
:rules [
[:##spacebar [["extend" 1][:is_in_gdoc]] :!blocked {:afterup [["extend" 0]["in-gdoc" 0]] :alone :spacebar}]
:extend
;~ system wide shortcuts for top utilities
[:escape nil nil {:alone :escape :held :system-force_quit_apps}]
[:non_us_backslash nil nil {:alone :!Fh :held :activate_hazeover}]
[:tab :!!left_arrow]
[:return_or_enter :!Fspacebar]
;~ power apps & window positioning - 1 hand switching
[:q ["fn_base" 1] nil {:alone :!!1 :afterup ["fn_base" 0]}]
[:w ["fn_ctrl" 1] nil {:alone :!!2 :afterup ["fn_ctrl" 0]}]
[:e ["fn_tmux" 1] nil {:alone :!!3 :afterup ["fn_tmux" 0]}]
[:r ["fn_nvim" 1] nil {:alone :!!4 :afterup ["fn_nvim" 0]}]
[:t ["fn_nvim" 1] nil {:alone :!!5 :afterup ["fn_nvim" 0]}]
[:y ["fn_nvim" 1] nil {:alone :!!6 :afterup ["fn_nvim" 0]}]
;~ switch between apps in the same stack
[:left_shift :left_shift ["yabai_stack" 1] {:alone :!Fj}]
[:right_shift :right_shift ["yabai_stack" 1] {:alone :!Fl}]
[:left_shift :left_shift ["yabai_stack" 0] {:alone :!Fcomma}]
[:right_shift :right_shift ["yabai_stack" 0] {:alone :!Fperiod}]
;~* function keys & social apps
[:##1 nil nil {:alone :f1 :held [:open "Transmission"]}]
[:##2 nil nil {:alone :f2 :held [:open "Google Chrome"]}]
[:##3 nil nil {:alone :f3 :held [:open "Messages"]}]
[:##4 nil nil {:alone :f4 :held :!CS4}]
[:##5 nil nil {:alone :f5 :held :!CS5}]
[:##6 nil nil {:alone :f6 :held [:open_social "Discord"]}]
[:##7 nil nil {:alone :f7 :held [:open_social "Telegram"]}]
[:##8 nil nil {:alone :f8 :held [:open_social "WhatsApp"]}]
[:##9 nil nil {:alone :f9 :held [:open_social "Slack"]}]
[:##0 nil nil {:alone :f10 :held [:open_social "Messages"]}]
[:##hyphen nil nil {:alone :f11 :held [:open_social "Skype"]}]
[:##equal_sign nil nil {:alone :f12 :held [:open_social "zoom.us"]}]
; per-app key definitions
; arc
[:u :!Cleft_arrow :arc]
[:o :!Cright_arrow :arc]
[:comma :!CSopen_bracket :arc]
[:period :!CSclose_bracket :arc]
[:!Tcomma :!Oup_arrow :arc]
[:!Tperiod :!Odown_arrow :arc]
; chrome
[:u :!Cleft_arrow :chrome]
[:o :!Cright_arrow :chrome]
[:comma :safari-prev_tab :chrome]
[:period :safari-next_tab :chrome]
; evernote
[:u :evernote-beginning_of_line :evernote]
[:o :evernote-end_of_line :evernote]
; drafts
[:u :drafts-beginning_of_line :drafts]
[:o :drafts-end_of_line :drafts]
[:comma :!TStab :drafts]
[:period :!Ttab :drafts]
; emacs
[:u :!Cleft_arrow :emacs]
[:o :!Cright_arrow :emacs]
; goodnotes
[:g :e :goodnotes]
[:v :p :goodnotes]
[:d :l :goodnotes]
[:h :h :goodnotes]
[:caps_lock :s :goodnotes]
[:a :!Chyphen :goodnotes]
[:s :!Cequal_sign :goodnotes]
[:f {:pkey :button1} :goodnotes]
; firefox
[:right_command :!Tperiod :firefox]
; kitty
[:!Tcomma :kitty-prev_tab :kitty]
[:!Tperiod :kitty-next_tab :kitty]
[:u [:!Ta :a] :kitty]
[:o :!Te :kitty]
[:!Cj [:!Ta :left_arrow] :kitty]
[:!Ck [:!Ta :down_arrow] :kitty]
[:!Ci [:!Ta :up_arrow] :kitty]
[:!Cl [:!Ta :right_arrow] :kitty]
[:!Oj :!Ob :kitty]
[:!Ol :!Of :kitty]
[:!Tj [:!Tw :left_arrow] :kitty]
[:!Tk [:!Tw :down_arrow] :kitty]
[:!Ti [:!Tw :up_arrow] :kitty]
[:!Tl [:!Tw :right_arrow] :kitty]
[:comma [:!Ta :p] :kitty]
[:period [:!Ta :n] :kitty]
; mailmate
[:u :!Cleft_arrow :mailmate]
[:o :!Cright_arrow :mailmate]
; messages
[:!Ti :!TStab :messages]
[:!Tk :!Ttab :messages]
[:comma :!TStab :messages]
[:period :!Ttab :messages]
; opera
[:comma :opera-prev_tab :opera]
[:period :opera-next_tab :opera]
; safari
[:u :!Cleft_arrow :safari]
[:o :!Cright_arrow :safari]
[:right_command :!COk :safari]
[:comma :safari-prev_tab :safari]
[:period :safari-next_tab :safari]
[:!Tcomma :!Oup_arrow [:safari ["in-gdoc" 1]]]
[:!Tperiod :!Odown_arrow [:safari ["in-gdoc" 1]]]
; stickies
[:u :!Cleft_arrow :stickies]
[:o :!Cright_arrow :stickies]
[:!Oi [:!Cleft_arrow :!CSright_arrow :!Cx :delete_forward :up_arrow :!Cleft_arrow :!COSv :return_or_enter :up_arrow] :stickies]
[:!Ok [:!Cleft_arrow :!CSright_arrow :!Cx :delete_forward :down_arrow :!Cleft_arrow :!COSv :return_or_enter :up_arrow] :stickies]
; telegram
[:comma :!COup_arrow :telegram]
[:period :!COdown_arrow :telegram]
; vivaldi
[:u :!Cleft_arrow :vivaldi]
[:o :!Cright_arrow :vivaldi]
[:comma :!CSopen_bracket :vivaldi]
[:period :!CSclose_bracket :vivaldi]
[:!Tcomma :!Oup_arrow :vivaldi]
[:!Tperiod :!Odown_arrow :vivaldi]
; vscode
[:comma :focus_editor_left :vscode]
[:period :focus_editor_right :vscode]
[:##right_command :!COm :vscode] ; maximize panel
[:!Tcomma :!COTleft_arrow :vscode]
[:!Tperiod :!COTright_arrow :vscode]
; workflowy
[:!Ok :!CSdown_arrow :workflowy]
[:!Oi :!CSup_arrow :workflowy]
[:comma :!Ccomma :workflowy]
[:period :!Cperiod :workflowy]
[:!Ti :!CS9 :workflowy]
[:!Tk :!CS0 :workflowy]
[:return_or_enter :!Creturn_or_enter :workflowy]
; zoom
[:comma :!Tp :zoom]
[:period :!Tn :zoom]
; global settings
[:!Tj :home]
[:!Tl :end]
[:!TSj :!Shome]
[:!TSl :!Send]
[:!Ti :page_up]
[:!Tk :page_down]
[:!TSi :!Spage_up]
[:!TSk :!Spage_down]
; reposition some keys closer
[:##f :return_or_enter]
[:##g :delete_or_backspace]
; modifiers
[:##caps_lock :left_control nil {:alone :escape}]
[:##a :left_shift]
[:##s :left_option]
[:##d :left_command]
; arrows
[:##j :left_arrow]
[:##k :down_arrow]
[:##i :up_arrow]
[:##l :right_arrow]
; shortcuts
[:!!u :page_up]
[:!!o :page_down]
[:##u :home]
[:##o :end]
; edit/organize text properly
[:##quote :insert]
[:##h :delete_or_backspace]
[:##semicolon :delete_forward]
; spaces navigation
[:n :!!left_arrow]
[:m :!!left_arrow]
[:slash :!!right_arrow]
[:condi :extend :colemak_unshifted]
; undo, cut, copy, paste on colemak
[:##z :!Cz][:##x :!Cx][:##c :!Cc][:##v :!Cv]
[:condi :extend :!colemak_unshifted]
; undo, cut, copy, paste on mod-wide on colemak
[:##grave_accent_and_tilde :!Cz][:##z :!Cx][:##x :!Cc][:##c :!Cv]
]
}
{
:des "Colemak - Unshifted Layout"
:rules [
; colemak
[:condi :!qwerty :colemak_unshifted]
; mod-wide colemak on the apple keyboard (full layout below; some keys are the same as QWERTY)
[:##non_us_backslash :grave_accent_and_tilde]
[:##q :q][:##w :w][:##e :f][:##r :p][:##t :g][:##y :j][:##u :l][:##i :u][:##o :y][:##p :semicolon]
[:##a :a][:##s :r][:##d :s][:##f :t][:##g :d][:##h :h][:##j :n][:##k :e][:##l :i][:##semicolon :o]
[:##grave_accent_and_tilde :non_us_backslash][:##z :z][:##x :x][:##c :c][:##v :v][:##b :b][:##n :k][:##m :m]
]
}
{
:des "Colemak - Shifted Layout"
:rules [
; colemak
[:condi :!qwerty]
; mod-wide colemak on the apple keyboard (full layout below; some keys are the same as QWERTY)
[:##non_us_backslash :grave_accent_and_tilde]
[:##q :q][:##w :w][:##e :f][:##r :p][:##t :g][:##y :j][:##u :l][:##i :u][:##o :y][:##p :semicolon]
[:##a :a][:##s :r][:##d :s][:##f :t][:##g :d][:##h :h][:##j :n][:##k :e][:##l :i][:##semicolon :o]
[:##grave_accent_and_tilde :z][:##z :x][:##x :c][:##c :v][:##v :b][:##b :spacebar][:##n :k][:##m :m]
]
}
]
}
;; rule [:period ["media-mode" 1] nil {:afterup ["media-mode" 0] :alone :period}]
;; |_____| |_______________| |_| |_________________________________________|
;; <from> <to> <conditions> <other options>
;;
;; ! | means mandatory - modifier(s) alone when pressend change behavior
;; # | means optional - modifiers are optional (but atleast one necessary)
;;
;; :!Ca is keycode :a and prefix a with !C
;;
;; C | left_command
;; T | left_control
;; O | left_option
;; S | left_shift
;; F | fn
;; Q | right_command
;; W | right_control
;; E | right_option
;; R | right_shift
;; P | caps_lock
;;
;; ## | optional any (this has no effect when used on the RHS; only LHS)
;; !! | command + control + option + shift (hyper)
;;
;; to understand better how modifiers work in karabiner
;; karabiner definition of mandatory and optional
;; https://karabiner-elements.pqrs.org/docs/json/complex-modifications-manipulator-definition/from/modifiers/
;;
;; need to prefix C T O S F P with ! or #
;;
;; code for all this:
;; https://github.com/yqrashawn/GokuRakuJoudo/blob/b9b334a187379f9bc8182ad59e2cca2a1789e9c0/src/karabiner_configurator/keys.clj#L68
;;
;;
;; list of keys usable in Karabiner
;; https://github.com/pqrs-org/Karabiner-Elements/issues/925#issuecomment-323984568
;;
;; Sample mouse event remapping
;; Could be used in a layer. Intercepting events from mice interferes with the scrollwheel.
;; [{:pkey :button2} :delete_forward]
;;
;;
;; URL of extend layer - https://forum.colemak.com/topic/2014-extend-extra-extreme/