Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Created August 19, 2024 23:21
Show Gist options
  • Save yoshuawuyts/aa945ea7d61b2c398a39a4f58253b5d4 to your computer and use it in GitHub Desktop.
Save yoshuawuyts/aa945ea7d61b2c398a39a4f58253b5d4 to your computer and use it in GitHub Desktop.
#|
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 ralt 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 (ralt rctl rmet))
smart-esc (fork esc @eng-esc (ralt 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)
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
;; b + j = caps-word (two shifts), then caps
(kb kj) @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)
(kd kh) @rus
;;
(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
;; (kz kx ) @undo
;; ( kx kc ) @cut
;; ( kc kd ) @copy
( kd kv) @paste
;;
;; f+p = vim command
(kf kp) (macro esc @colon)
;; w+f = vim save
(kw kf) (macro esc @colon w ret)
;; 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 ralt) @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)
;;
;; 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-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 x c 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
(qt qy) @capw
;;
(qz q/) (one-shot 1000 (layer-while-held U_BUTTON))
;;
(qv qm) @eng
;; 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
(qz qx ) @undo
( qx qc ) @cut
( qc qv ) @copy
( qv qb) @paste
;; 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
(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 c 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
met 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
XX 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
XX lsft lctl lalt lmet
XX bspc tab caps @backsl
XX XX XX
;; extra keys - not actually used, needed to intercept events
@lwh-ctl
)
(deflayer U_FUN
;; left
f12 f7 f8 f9 prtsc
f11 f4 f5 f6 slck
f10 f1 f2 f3 pause
comp spc tab
;; right
XX @n-bas @n-qwe @n-tap XX
ret sft ctl alt met
bspc 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 @lbrace
met alt ctl sft @lbrack
XX XX left right @caret
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=7.4 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[0].Gain+=1)
vold (cmd vmcli Bus[0].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
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment