-
Notifications
You must be signed in to change notification settings - Fork 1
/
kanata.kbd
/
kanata.kbd
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
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
#|
Written by Chuck in 2024
https://bogorad.github.io/
Based on the brilliant Miryoku_kmonad => Kinesis layout
https://github.com/manna-harbour/miryoku_kmonad
With enormous help from the author of Kanata
https://github.com/jtroo
This is my second attempt at Kanata configuration.
https://github.com/jtroo/kanata/
Reasons for choosing Kanata vs KMonad:
=========================
1. KMonad isn't friendly with the mouse.
2. KMonad can't do chords, and I need them
3. I like the idea of RUST better than HASKEL
https://github.com/bogorad/miryoku-kanata/blob/main/kanata.kbd
About layers:
=============
0. I closely follow the logic of Miryoku as applied to my Kinesis Advantage (KB500), only using 36 keys.
U_BASE is the default. I use COLEMAK-DH.
U_QWERTY - no key remapping, used for Cyrillic in Windows, with 2/3-taps for missing chars.
U_TAP has almost everything disabled (just U_NAV to be able to return to U_BASE); I don't use it, considering removal.
U_NUM has nubmers (basically, numpad+)
U_SYM - my own map. This is probably my strongest deviation from Miryoku, I didn't appreciate the idea of U_SYM being shifted U_NUM, so I stole someone's idea:
top row for shifted numbers,
the rest of the symbols in pairs, unshifted on bottom row, shifted on middle row.
U_FUN - for function and other seldom used keys
U_MOUSE - for mouse emulation and ENG/RUS switching. Although since I put Cyrillic layer on a countdown timer, I rarely use direct switching on this layer; considering its removal. Mouse follows U_NAV layer (see below).
U_BUTTON has buttons and HYPER-combos to be interpreted by the OS. Just starting.
U_NAV is heavily modified. Although I'm a 20+year Vim user, I find fascination with h/j/k/l quite silly. Consequently, I remapped directional keys in the w/a/s/d style, for the right hand (obviously; NAV key is uner my left thumb. Also moved PgUp/PgDn. Also added {[()]} heavily used in Vim navigation - also saving precious space on U_SYM layer. The only(?) two exceptions to the left/right-hand rule - the left/right keys on C/D so that when watching Youtube I can skip boring parts using my thumb+index fingers.
Put a lot of effort so that symbols send the same codes regardless of the input language (Cyrillic screws it up badly). Even had to create a special symbols layer for Cyrillic. Most are Unicode, but not all - my beloved ZTree is a console application and expects "real" keys.
Put comma, dot and question mark on chords.
Added chords for vim-save and vim-cmd.
Make heavy use of deffakekeys - for input-language + layer switching, timed-out.
In Windows, Hyper-keys are handled by MS PowerToys at the moment, considering a switch to Autohotkey.
Undo/Cut/Copy/Paste are chords on z/x/c/d/v.
Notable changes from Miryoku/Kinesis:
U_BASE:
1.1. Restored home-row mod-taps. To fix problems due to rolls, I use _FAST layers.
1.1.1. All keys in U_BASE are mapped to chords. Very easy to add new ones!
1.1.2. When a key is pressed, its code is passed to chords.
1.1.3. Chord decides if it's a single key (e.g., @met-a which is a/meta),
1.2. Added some chords
1.3. Got tired of unintentional 'enter' taps, assigned ret to a chord, disabled on kbd.
U_NAV
2.1. Changed direction keys: h/j/k/l with Colemak is just stupid.
2.2. Added [{()}] for VIM-style navigation
2.3. Moved CAPS, I use CAPS-WORD anyway
2.4. n/a
2.5. Threw away copy/cut/paste, used chords instead.
2.6. Moved home/end, pgup/pgdn.
2.7. n/a.
2.8. Not on this layer, but related to navigation: modified tab/esc always resets the language to ENG
U_MOUSE
3.1. Changed direction keys to match U_NAV.
3.2. Added language switching ENG/RUS, one more slot available; not much use any longer since Cyrillic is on a 5-second timeout
3.3. Moved scroll wheel buttons
3.4. This and U_MEDIA are the only two layers
where U_TAP/U_QWERTY/U_BASE switching is possible
3.5. Threw away copy/cut/paste, use chords in U_BASE nstead.
3.6. Assigned DELETE key to V, easy to reach when my right hand is on the mouse.
U_SYM was revised completely. Followed the advice
to keep !@#$%^&*() to use existing muscle memory.
Added more keys. Mapped / to \. TBD
The real lctl key on my keyboard is not used, but defined in defsrc so that my mouse's copy/paste keys work.
Here'a an empty layer declaration,
so we can copy+paste it and customize
(deflayer U_DUMMY
;; right half
XX XX XX XX XX
XX XX XX XX XX
XX XX XX XX XX
;; thumbs
XX XX XX
;; left half
XX XX XX XX XX
XX XX XX XX XX
XX XX XX XX XX
;; thumbs
XX XX XX
;; extra keys - not actually used, needed to intercept events
XX
)
|#
;; config stuff
(environment (KANATA_PLATFORM windows)
(defcfg
process-unmapped-keys yes
block-unmapped-keys yes
danger-enable-cmd yes
movemouse-inherit-accel-state yes
;; icon-match-layer-name no ;;|yes| match layer name to icon files even without an explicit (icon name.ico) config
tooltip-layer-changes no
tooltip-no-base true
notify-cfg-reload true
notify-cfg-reload-silent true
)
)
(environment (KANATA_PLATFORM hyperv)
(defcfg
process-unmapped-keys yes
block-unmapped-keys yes
danger-enable-cmd yes
movemouse-inherit-accel-state yes
linux-dev /dev/input/by-path/acpi-VMBUS\:00-serio-0-event-kbd
)
)
(environment (KANATA_PLATFORM hardware)
(defcfg
process-unmapped-keys yes
block-unmapped-keys yes
danger-enable-cmd yes
movemouse-inherit-accel-state yes
linux-dev /dev/input/by-id/usb-05ac_0204-event-kbd
)
)
(environment (KANATA_PLATFORM qemu)
(defcfg
process-unmapped-keys yes
block-unmapped-keys yes
danger-enable-cmd yes
movemouse-inherit-accel-state yes
linux-dev /dev/input/by-path/platform-i8042-serio-0-event-kbd
)
)
;; global variables
(defvar
tap-timeout 200
hold-timeout 200
tt $tap-timeout
ht $hold-timeout
)
;; we'll process only these keys
;; using left and right halves of
;; the keyboard separately
;; this is the default
(environment (KANATA_LAYOUT kinesis)
(defsrc
;; left
q w e r t
a s d f g
z x c v b
bspc del end
;; right
y u i o p
h j k l ;
n m , . /
pgdn ent spc
;; extra keys - not actually used, needed to intercept events
;; generated by my mouse
lctrl
)
)
;; laptop config
(environment (KANATA_LAYOUT laptop)
(defsrc
;; left
2 3 4 5 6
q w e r t
caps a s d f
x c v
;; right
7 8 9 0 -
u i o p [
j k l ; '
n m ,
;; extra keys - not actually used, needed to intercept events
;; generated by my mouse
lctrl
)
)
#|
This section is here because of the way Kanata processes
events. The idea is that FakeKeys make an action atomic,
so it can be serialized via (macro fake real whatever)
|#
(defvirtualkeys
;; win-input switching - add more here
fake-win-eng (multi (release-key rctl) (release-key rmet) lalt lsft 0)
fake-win-rus (multi (release-key rctl) (release-key rmet) lalt lsft 1)
;;
;; permanent layer-switching
fake-lsw-bas (layer-switch U_BASE)
fake-lsw-baf (layer-switch U_BASE_FAST)
fake-lsw-fun (layer-switch U_FUN)
fake-lsw-nav (layer-switch U_NAV)
fake-lsw-num (layer-switch U_NUM)
fake-lsw-med (layer-switch U_MEDIA)
fake-lsw-mou (layer-switch U_MOUSE)
fake-lsw-qwe (layer-switch U_QWERTY)
fake-lsw-qwf (layer-switch U_QWERTY_FAST)
fake-lsw-qwl (layer-switch U_RUS_LEO)
fake-lsw-tap (layer-switch U_TAP)
fake-lsw-sym (layer-switch U_SYM)
fake-lsw-syr (layer-switch U_SYM_RUS)
;;
;; symbols to be handled by OS
fake-hyper-a (multi rmet rctl lalt a)
fake-hyper-b (multi lmet lctl lalt b)
fake-hyper-c (multi lmet lctl lalt c)
fake-hyper-d (multi lmet lctl lalt d)
fake-hyper-e (multi lmet lctl lalt e)
fake-hyper-f (multi lmet lctl lalt f)
fake-hyper-g (multi lmet lctl lalt g)
fake-hyper-h (multi lmet lctl lalt h)
fake-hyper-i (multi lmet lctl lalt i)
fake-hyper-j (multi lmet lctl lalt j)
fake-hyper-k (multi lmet lctl lalt k)
;;
fake-lang-switch-eng (multi
(on-press tap-virtualkey fake-win-eng)
(on-press tap-virtualkey fake-lsw-bas)
)
fake-lang-switch-rus (multi
(on-press tap-virtualkey fake-win-rus)
(on-press tap-virtualkey fake-lsw-qwe)
(on-idle 3000 tap-virtualkey fake-lang-switch-eng)
)
fake-lang-switch-rus-notimeout (multi
(on-press tap-virtualkey fake-win-rus)
(on-press tap-virtualkey fake-lsw-qwe)
)
;;
fake-lang-switch-rus-leo (multi
(on-press tap-virtualkey fake-win-rus)
(on-press tap-virtualkey fake-lsw-qwl)
)
)
;; shorter names for fake keys etc
(defalias
;; shorter names for layer switches
lsw-bas (on-press tap-virtualkey fake-lsw-bas)
lsw-baf (on-press tap-virtualkey fake-lsw-baf)
lsw-fun (on-press tap-virtualkey fake-lsw-fun)
lsw-nav (on-press tap-virtualkey fake-lsw-nav)
lsw-num (on-press tap-virtualkey fake-lsw-num)
lsw-med (on-press tap-virtualkey fake-lsw-med)
lsw-mou (on-press tap-virtualkey fake-lsw-mou)
lsw-qwe (on-press tap-virtualkey fake-lsw-qwe)
lsw-qwf (on-press tap-virtualkey fake-lsw-qwf)
lsw-qwl (on-press tap-virtualkey fake-lsw-qwl)
lsw-tap (on-press tap-virtualkey fake-lsw-tap)
lsw-sym (on-press tap-virtualkey fake-lsw-sym)
lsw-syr (on-press tap-virtualkey fake-lsw-sym)
;; shorter names for input switching in Windows
eng (on-press tap-virtualkey fake-lang-switch-eng)
rus (on-press tap-virtualkey fake-lang-switch-rus)
rus-nt (on-press tap-virtualkey fake-lang-switch-rus-notimeout)
rus-leo (on-press tap-virtualkey fake-lang-switch-rus-leo)
)
;; aliases - so we can use short labels in layer maps
(defalias
;; layer switching
;; temporary layer switching
lwh-bas (layer-while-held U_BASE)
lwh-baf (layer-while-held U_BASE_FAST)
lwh-but (layer-while-held U_BUTTON)
lwh-fun (layer-while-held U_FUN)
lwh-nav (layer-while-held U_NAV)
lwh-num (layer-while-held U_NUM)
lwh-med (layer-while-held U_MEDIA)
lwh-mou (layer-while-held U_MOUSE)
lwh-sym (layer-while-held U_SYM)
lwh-syr (layer-while-held U_SYM_RUS)
lwh-ctl (layer-while-held U_CTL)
lwh-qwx (layer-while-held U_QWERTY_EXTRA)
;;
;; switch to English and then send tab/escape
eng-tab (macro @eng 100 tab)
eng-esc (macro @eng 100 esc)
;; do eng-tab if any of right-side HRMs are active, tab otherwise
smart-tab (fork tab @eng-tab (lalt rctl rmet))
smart-esc (fork esc @eng-esc (lalt rctl rmet))
;;
;; tap-hold actions for thumb keys
;; left (left-2-right order)
esc-med (tap-hold-press $tt $ht @smart-esc @lwh-med)
esc-qwx (tap-hold-press $tt $ht @smart-esc @lwh-qwx)
spc-nav (tap-hold-press $tt $ht spc @lwh-nav)
d-nav (tap-hold-press $tt $ht (chord bas-chords kd) @lwh-nav)
tab-mou (tap-hold-press $tt $ht @smart-tab @lwh-mou)
;; right (left-2-right order)
ret-sym (tap-hold-press $tt $ht XX @lwh-sym)
ret-syr (tap-hold-press $tt $ht XX @lwh-syr)
bks-num (tap-hold-press $tt $ht bks @lwh-num)
del-fun (tap-hold-press $tt $ht del @lwh-fun)
;; this was an expiriment. decided against it, doesn't add much in COLEMAK_DH
;; e-fun (tap-hold-press $tt $ht e @lwh-fun)
;;
)
#|
UNICODE section
have to resort to Unicode entry since many symbols in Cyrillic layout
are mapped to letters
|#
(defalias
;; doesn't auto-repeat
lparen (macro S-9)
rparen (macro S-0)
;; {[()]}
lbrace (unicode {)
rbrace (unicode })
lbrack (unicode [)
rbrack (unicode ])
;; extra
grave (unicode `)
tilde (unicode ~)
slash (unicode /)
pipe (unicode |)
backsl (unicode \)
;;
colon (unicode :)
semicl (unicode ;)
;;
plus (unicode +)
equal (unicode =)
minus (unicode -)
unders (unicode _)
;;
dot (unicode .)
comma (unicode ,)
q-mark (unicode ?)
;;
at (unicode @)
hash (unicode #)
;;
dollar (unicode $)
;;
percen (unicode %)
caret (unicode ^)
ampers (unicode &)
;;
apo (unicode ')
;;
gt (unicode >)
lt (unicode <)
;;
email (macro b o g o r a d @at g m a i l . c o m)
)
(defalias
;; aliases for secondary layers:
;; no-key / permanent layer-switch
;; EXPLANATION:
;; first tap => no action (XX)
;; you need to TAP the key TWICE, timeout=200ms,
;; to permanently SWITCH to the layer wanted
n-tap (tap-dance $tt (XX @lsw-tap))
n-qwe (tap-dance $tt (XX @lsw-qwe))
n-bas (tap-dance $tt (XX @lsw-bas))
;; aliases for COPY/PASTE/etc (macro so norepeat)
copy (macro C-ins)
paste (macro S-ins)
cut (macro S-del)
undo (macro C-z)
redo (macro C-y)
;; symbols to be handied by OS
;; this references Fake-keys defined above
s-btc (on-press tap-virtualkey fake-hyper-b)
s-hyE (on-press tap-virtualkey fake-hyper-e)
s-hyF (on-press tap-virtualkey fake-hyper-f)
s-hyG (on-press tap-virtualkey fake-hyper-g)
s-hyH (on-press tap-virtualkey fake-hyper-h)
s-hyI (on-press tap-virtualkey fake-hyper-i)
s-hyJ (on-press tap-virtualkey fake-hyper-j)
s-hyK (on-press tap-virtualkey fake-hyper-k)
;; caps-word(for 3 sec) or caps
capw (caps-word 3000)
;; layer switch for fast typing
bfast (multi
@lsw-baf
(on-idle 35 tap-virtualkey fake-lsw-bas)
)
)
;; U_BAS: Chords for home row and more:
(defchords bas-chords 80
(kp kl) @capw
;; z+/ = BUTTON layer only for the hext tap
(kz k/) (one-shot 1000 (layer-while-held U_BUTTON))
;; switch to Russian (it's on a timeout so no need to define the reverse key)
(kv kk) @rus
(kb kj) @eng
;;
(ka ko) lmet
(kr ki) lalt
;;
;; all keys are mapped so that it's easy to create new chords
;; left half
(kq ) (multi q @bfast)
( kw ) (multi w @bfast)
( kf ) (multi f @bfast)
( kp ) (multi p @bfast)
( kb) (multi b @bfast)
;;
(ka ) (multi (tap-hold $tt $ht a lmet) @bfast)
( kr ) (multi (tap-hold $tt $ht r lalt) @bfast)
( ks ) (multi (tap-hold $tt $ht s lctl) @bfast)
( kt ) (multi (tap-hold $tt $ht t lsft) @bfast)
( kg) (multi g @bfast)
;;
(kz ) (multi z @bfast)
( kx ) (multi x @bfast)
( kc ) (multi c @bfast)
( kd ) (multi d @bfast)
( kv) (multi v @bfast)
;; Undo/Cut/Copy/Paste
(kf kp) tab
(kc kd) @paste
;;
;; w+f = vim save
(kw kf) (macro esc @colon w ret)
;; p+b = {, t+g = [
(kp kb) S-{ ;;(macro @lbrace)
(kt kg) [ ;;(macro @lbrack)
(kd kv) S-9 ;;(macro @lparen)
;; right half
(kj ) (multi j @bfast)
( kl ) (multi l @bfast)
( ku ) (multi u @bfast)
( ky ) (multi y @bfast)
( k') (multi ' @bfast)
;;
(km ) (multi m @bfast)
( kn ) (multi (tap-hold $tt $ht n rsft) @bfast)
( ke ) (multi (tap-hold $tt $ht e rctl) @bfast)
( ki ) (multi (tap-hold $tt $ht i lalt) @bfast)
( ko) (multi (tap-hold $tt $ht o rmet) @bfast)
;;
(kk ) (multi k @bfast)
( kh ) (multi h @bfast)
( k, ) (multi , @bfast)
( k. ) (multi . @bfast)
( k/) (multi / @bfast)
;;
;; j+l = }, m+n = ]
(kj kl) S-} ;;(macro @rbrace)
(km kn) ] ;;(macro @rbrack)
(kk kh) S-0 ;;(macro @rparen)
;; u + y = enter, since the "real" enter is disabled
(ku ky) ret
;; l + u = shift+enter, since the "real" enter is disabled
(kl ku) S-ret
;; , . / are chords so that they work both in English and in Russian
(kh k,) ,
(k, k.) .
(k. k/) @q-mark
)
(defalias
;; left half
;; first row
bas-q (chord bas-chords kq)
bas-w (chord bas-chords kw)
bas-f (chord bas-chords kf)
bas-p (chord bas-chords kp)
bas-b (chord bas-chords kb)
;;second row
bas-a (chord bas-chords ka)
bas-r (chord bas-chords kr)
bas-s (chord bas-chords ks)
bas-t (chord bas-chords kt)
bas-g (chord bas-chords kg)
;; third row
bas-z (chord bas-chords kz)
bas-x (chord bas-chords kx)
bas-c (chord bas-chords kc)
;; bas-d (chord bas-chords kd)
bas-d @d-nav
bas-v (chord bas-chords kv)
;; thumbs
;; bas-bks (chord bas-chords k-bks)
bas-bks @esc-med
bas-del @spc-nav
bas-end @tab-mou
;; right half
;; first row
bas-j (chord bas-chords kj)
bas-l (chord bas-chords kl)
bas-u (chord bas-chords ku)
bas-y (chord bas-chords ky)
bas-' (chord bas-chords k')
;; second row
bas-m (chord bas-chords km)
bas-n (chord bas-chords kn)
bas-e (chord bas-chords ke)
bas-i (chord bas-chords ki)
bas-o (chord bas-chords ko)
;; third row
bas-k (chord bas-chords kk)
bas-h (chord bas-chords kh)
bas-, (chord bas-chords k,)
bas-. (chord bas-chords k.)
bas-/ (chord bas-chords k/)
;; thumbs
bas-pgd @ret-sym
bas-ret @bks-num
bas-spc @del-fun
)
#|
main layout: Colemac-DH with extra keys:
home-row modifiers:
MACS/WACS
extra:
z + / => button layer
thumb special layer mappings - left side:
(left-to-right):
esc => media
space => navigation
tab => mouse
thumb special layer mappings - right side:
(left-to-right):
enter (disabled) => symbols
backspace => numbers
delete => functions
|#
(deflayer U_BASE
;; left
@bas-q @bas-w @bas-f @bas-p @bas-b
@bas-a @bas-r @bas-s @bas-t @bas-g
@bas-z @bas-x @bas-c @bas-d @bas-v
@bas-bks @bas-del @bas-end
;; right
@bas-j @bas-l @bas-u @bas-y @bas-'
@bas-m @bas-n @bas-e @bas-i @bas-o
@bas-k @bas-h @bas-, @bas-. @bas-/
@bas-pgd @bas-ret @bas-spc
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; base layer for FAST typing
(deflayer U_BASE_FAST
;; left
q w f p b
a r s t g
z @bas-x @bas-c @bas-d v
@bas-bks @bas-del @bas-end
;; right
j @bas-l @bas-u @bas-y '
m n e i o
k h , . /
@bas-pgd @bas-ret @bas-spc
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; now deal with Cyrillic
(defalias qfast
(multi
@lsw-qwf
(on-idle 35 tap-virtualkey fake-lsw-qwe)
)
;; Since I decided to use ,./ in both layouts, need to map these keys properly
qcomma (fork @comma @lt (lsft))
qdot (fork @dot @gt (lsft))
qslash (fork @slash @q-mark (lsft))
)
;; we want ctrl+ combos to work as if we're in U_BAS
(defalias
q-dctl (tap-hold $tt $ht d (multi @lwh-baf ctl))
q-kctl (tap-hold $tt $ht k (multi @lwh-baf ctl))
)
;; U_QWERTY:
(defchords qwe-chords 40
;; f + j = caps-word
(qr qu) @capw
;;
(qz q/) (one-shot 1000 (layer-while-held U_BUTTON))
;;
;; switch to English
(qt qy) @eng
(qv qm) @rus
;; left half
(qq ) (multi q @qfast)
( qw ) (multi w @qfast)
( qe ) (multi e @qfast)
( qr ) (multi r @qfast)
( qt) (multi t @qfast)
;;
(qa ) (multi (tap-hold $tt $ht a lmet) @qfast)
( qs ) (multi (tap-hold $tt $ht s lalt) @qfast)
;; ( qd ) (multi (tap-hold $tt $ht d lctl) @qfast)
( qd ) (multi @q-dctl @qfast)
( qf ) (multi (tap-hold $tt $ht f lsft) @qfast)
( qg) (multi g @qfast)
;;
(qz ) (multi z @qfast)
( qx ) (multi x @qfast)
( qc ) (multi c @qfast)
( qv ) (multi v @qfast)
( qb) (multi b @qfast)
;; Undo/Cut/Copy/Paste
(qe qr) tab
(qc qv) @paste
(qr qt) @lbrace
(qf qg) @lbrack
(qv qb) @lparen
;; right half
(qy ) (multi y @qfast)
( qu ) (multi u @qfast)
( qi ) (multi i @qfast)
( qo ) (multi o @qfast)
( qp) (multi p @qfast)
;;
(qh ) (multi h @qfast)
( qj ) (multi (tap-hold $tt $ht j lsft) @qfast)
;; ( qk ) (multi (tap-hold $tt $ht k lctl) @qfast)
( qk ) (multi @q-kctl @qfast)
( ql ) (multi (tap-hold $tt $ht l lalt) @qfast)
( q;) (multi (tap-hold $tt $ht ; lmet) @qfast)
;;
(qn ) (multi n @qfast)
( qm ) (multi m @qfast)
( q, ) (multi , @qfast)
( q. ) (multi @qdot @qfast)
( q/) (multi @qslash @qfast)
;;
(qi qo) ret
;; l + u = shift+enter, since the "real" enter is disabled
(qu qi) S-ret
(qy qu) @rbrace
(qh qj) @rbrack
(qn qm) @rparen
(qm q,) @comma
(q, q.) @dot
(q. q/) S-7
)
(defalias
;; left half
;; first row
qwe-q (chord qwe-chords qq)
qwe-w (chord qwe-chords qw)
qwe-e (chord qwe-chords qe)
qwe-r (chord qwe-chords qr)
qwe-t (chord qwe-chords qt)
;; second row
qwe-a (chord qwe-chords qa)
qwe-s (chord qwe-chords qs)
qwe-d (chord qwe-chords qd)
qwe-f (chord qwe-chords qf)
qwe-g (chord qwe-chords qg)
;; third row
qwe-z (chord qwe-chords qz)
qwe-x (chord qwe-chords qx)
qwe-c (chord qwe-chords qc)
qwe-v (chord qwe-chords qv)
qwe-b (chord qwe-chords qb)
;; thumbs
qwe-bks @esc-qwx
qwe-del @spc-nav
qwe-end @tab-mou
;; right half(chord qwe-chords qz)
;; first row
qwe-y (chord qwe-chords qy)
qwe-u (chord qwe-chords qu)
qwe-i (chord qwe-chords qi)
qwe-o (chord qwe-chords qo)
qwe-p (chord qwe-chords qp)
;; second row
qwe-h (chord qwe-chords qh)
qwe-j (chord qwe-chords qj)
qwe-k (chord qwe-chords qk)
qwe-l (chord qwe-chords ql)
qwe-; (chord qwe-chords q;)
;; third row
qwe-n (chord qwe-chords qn)
qwe-m (chord qwe-chords qm)
qwe-, (chord qwe-chords q,)
qwe-. (chord qwe-chords q.)
qwe-/ (chord qwe-chords q/)
;; thumbs
qwe-pgd @ret-syr
qwe-ret @bks-num
qwe-spc @del-fun
)
(deflayer U_QWERTY
;; left
@qwe-q @qwe-w @qwe-e @qwe-r @qwe-t
@qwe-a @qwe-s @qwe-d @qwe-f @qwe-g
@qwe-z @qwe-x @qwe-c @qwe-v @qwe-b
@qwe-bks @qwe-del @qwe-end
;; right
@qwe-y @qwe-u @qwe-i @qwe-o @qwe-p
@qwe-h @qwe-j @qwe-k @qwe-l @qwe-;
@qwe-n @qwe-m @qwe-, @qwe-. @qwe-/
@qwe-pgd @qwe-ret @qwe-spc
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_QWERTY_FAST
;; left
q w e r t
a s d f g
z x @qwe-c @qwe-v b
@qwe-bks @qwe-del @qwe-end
;; right
y @qwe-u @qwe-i @qwe-o p
h j k l ;
n m @qwe-, @qwe-. @qwe-/
@qwe-pgd @qwe-ret @qwe-spc
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_QWERTY_EXTRA
;; left
XX XX XX XX XX
met alt ctl sft XX
XX XX XX XX XX
@qwe-bks @qwe-del @qwe-end
;; right
XX [ ` ' XX
XX XX XX XX XX
XX ] , . @backsl
XX pp @mutetg
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; experimental layer for Russian
;; based on Leonov's work here: https://habr.com/ru/articles/717912/
(deflayer U_RUS_LEO
;; left
;;ц к л б й
w r k , q
;;з в н т д
p d y n l
;;х п р м г
[ g h v u
@qwe-bks @qwe-del @qwe-end
;; right
;;ш ы я у ф
;;щ ч ж ё
o s z e a
;;ь а о е с
;;ъ у ю
m f j t c
;;ш и , . /
i b @comma @dot @slash
@qwe-pgd @qwe-ret @qwe-spc
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deflayer U_TAP
;; left
q w f p b
a r s t g
z x c d v
@esc-med spc tab
;; right
j l u y apo
m n e i o
k h , . /
ent bspc del
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_NUM
;; left
kp- 7 8 9 kp+
@colon 4 5 6 eql
@dollar 1 2 3 kp/
@dot 0 -
;; right
XX XX XX XX XX
ret sft ctl alt met
XX bspc tab caps @backsl
XX XX XX
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; !!! this is no longer just shifted S_NUM !!!
(deflayer U_SYM
;; left
S-1 S-2 S-3 S-4 S-5
S-\ S-` S-apo S-scln eql
\ ` apo scln XX
S-9 S-0 S--
;; right
S-6 S-7 S-8 S-9 S-0
ret lsft lctl lalt lmet
XX bspc tab caps \
XX XX XX
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; this is no longer just shifted S_NUM
(deflayer U_SYM_RUS
;; left
S-1 @at @hash @dollar @percen
@pipe @tilde S-2 @colon eql
@backsl @grave @apo @semicl XX
@lparen @rparen @unders
;; right
@caret @ampers S-8 S-9 S-0
ret lsft lctl lalt lmet
XX bspc tab caps @backsl
XX XX XX
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(defalias scr-ocr (cmd C:\Users\bogorad\AppData\Local\Programs\NormCap\NormCap.exe))
(deflayer U_FUN
;; left
f12 f7 f8 f9 prtsc
f11 f4 f5 f6 slck
f10 f1 f2 f3 @scr-ocr
comp spc tab
;; right
XX @n-bas @n-qwe @n-tap XX
ret sft ctl alt met
XX bspc tab caps @backsl
XX XX XX
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(defalias
hap-h (cmd c:\bin\hap\hap.exe /hint)
hap-t (cmd c:\bin\hap\hap.exe /tray)
)
(deflayer U_NAV
;; left
;; added keys {[^$]} for VIM navigation
lrld @n-tap @n-qwe @n-bas XX
met alt ctl sft XX
XX XX @paste XX XX
XX XX XX
;; right
@rbrace home up end pgup
@rbrack left down right pgdn
@dollar f23 C-f23 A-f23 M-f23
M-tab del ins
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_BUTTON
;; left
@email @s-btc XX XX XX
XX alt ctl sft @s-hyF
@s-hyG @s-hyH @s-hyI @s-hyJ @s-hyK
mmtp mltp mrtp
;; right
@redo @paste @cut @copy @undo
XX sft ctl alt met
@redo @paste @cut @copy @undo
mrtp mltp mmtp
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; some aliases for the mouse
(defalias
mwu (mwheel-up 500 120)
mwd (mwheel-down 500 120)
mwl (mwheel-left 50 120)
mwr (mwheel-right 50 120)
mm-up (movemouse-up 1 1)
mm-le (movemouse-left 1 1)
mm-dn (movemouse-down 1 1)
mm-ri (movemouse-right 1 1)
ma-up (movemouse-accel-up 1 1000 1 5)
ma-le (movemouse-accel-left 1 1000 1 5)
ma-dn (movemouse-accel-down 1 1000 1 5)
ma-ri (movemouse-accel-right 1 1000 1 5)
)
(deflayer U_MOUSE
;; left half
XX @n-tap @n-qwe @n-bas XX
met alt ctl sft XX
XX XX XX XX del
;; thumbs
XX XX XX
;; right half
@eng @mwl @ma-up @mwr @mwu
@rus-nt @ma-le @ma-dn @ma-ri @mwd
@rus-leo f24 C-f24 @hap-t @hap-h
;; thumbs - r/l/m mouse tapt (as opposed to clicks)
mrtp mltp mmtp
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
;; this tells VoiceMeeter to
;; turn mic passthrough to headphones
(defvirtualkeys
micon (cmd vmcli Strip[1].Gate=3 Strip[1].A1=1 Strip[1].B2=0)
micoff (cmd vmcli Strip[1].Gate=8.2 Strip[1].A1=0 Strip[1].B2=1)
)
;; ON when the key is pressed
;; OFF when it's released
(defalias
miconoff (multi
(on-press tap-virtualkey micon)
(on-release tap-virtualkey micoff)
)
;; reset sound system
sndrst (cmd vmcli.exe Command.Restart=1)
;; send commands to VoiceMeeter
mutetg (cmd vmcli !Bus[1].Mute;)
volu (cmd vmcli Bus[1].Gain+=1)
vold (cmd vmcli Bus[1].Gain-=1)
)
(deflayer U_MEDIA
;; left
;; since I use VoiceMeeter for all sound,
;;instead of volu/vold I send commands to it.
@sndrst @n-tap @n-qwe @n-bas XX
XX XX XX XX XX
XX XX XX XX XX
bks XX XX
;; right
XX XX @volu XX XX
XX prev @vold next @miconoff
XX XX XX XX XX
XX pp @mutetg
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_CTL
;; right half
XX XX XX XX XX
XX XX XX XX XX
XX XX C-ins S-ins XX
;; thumbs
XX XX XX
;; left half
XX XX XX XX XX
XX XX XX XX XX
XX XX XX XX XX
;; thumbs
XX XX XX
;; extra keys - not actually used, needed to intercept events
XX
)