nix-darwin/dotfiles/kanata/conf.kbd

181 lines
5.5 KiB
Text
Raw Normal View History

#|
Kanata Config
○ Ergonomic (kinda?) 34-key QWERTY layout
○ GACS home-row mods
○ Layers for function, number, media, and symbol keys
○ Dedicated (and non-intrusive!) standard layout toggle for reliant tasks
○ Decently commented for beginners and seasoned veterans alike.
FEEL FREE TO FORK!!!
|#
(defcfg
concurrent-tap-hold yes
movemouse-smooth-diagonals yes
2026-04-04 19:21:49 -04:00
macos-dev-names-include (
"0xD4359520DA829EC8" ;; Macbook
"0x2E7E3EBD4C615B55" ;; Macbook
"0x4C044B7D74E4DBB4" ;; Gamestop keeb
"0xC7C83E024FB08653" ;; Razer Hunstman V2 TKL
)
)
#|
Trying to be minimal in order to reduce constant editing
of layer keys, not to mention how ugly having a 60% layout
is when you have mapped keys in the grid.
|#
(defsrc
caps
q w e r t y u i o p
a s d f g h j k l scln
z x c v b n m , . /
lmet spc rmet
)
;; Variables for clean code
(defvar
tap-time 200
hold-time 250
chord-time 50
)
;; Bindings
(defalias
;; Normal keyboard layer for gaming/other normie usage
normie (layer-switch norm)
;; Key chord definitions
chw (chord ch w)
che (chord ch e)
chi (chord ch i)
cho (chord ch o)
chs (chord ch s)
chd (chord ch d)
2026-04-04 19:21:49 -04:00
chf (chord ch f)
chj (chord ch j)
chk (chord ch k)
chl (chord ch l)
ch_lmet (chord ch lmet)
ch_rmet (chord ch rmet)
;; Remap Caps to Escape/Nav layer
navlayer (layer-while-held nav)
caps (tap-hold $tap-time $hold-time (tap-dance 200 (esc caps)) @navlayer)
;; Home row mods
a (tap-hold $tap-time $hold-time a lctl)
s (tap-hold $tap-time $hold-time s lalt)
d (tap-hold $tap-time $hold-time d lmet)
f (tap-hold $tap-time $hold-time f lsft)
j (tap-hold $tap-time $hold-time j rsft)
k (tap-hold $tap-time $hold-time k lmet)
l (tap-hold $tap-time $hold-time l lalt)
scln (tap-hold $tap-time $hold-time scln rctl)
2026-04-04 19:21:49 -04:00
;; Meh and Hyper key definitions
hyper (multi lsft lctl lalt lmet)
meh (multi lsft lctl lalt)
;; Numpad layer
numpad (layer-while-held num)
g (tap-hold $tap-time $hold-time g @numpad)
;; Function key layer
fnkeys (layer-while-held fn)
h (tap-hold $tap-time $hold-time h @fnkeys)
#|
2026-04-04 19:21:49 -04:00
Meh key when V or M are held down to allow for either hand to
use hyper key for AHK/Raycast shortcuts.
|#
2026-04-04 19:21:49 -04:00
v (tap-hold $tap-time $hold-time v @meh)
m (tap-hold $tap-time $hold-time m (multi lsft lctl lalt))
;; Holding Spacebar activates symbol layer
symbols (layer-while-held symbol)
spc (tap-hold $tap-time $hold-time spc @symbols)
;; Media layer when Z or / are held.
medialy (layer-while-held md)
z (tap-hold $tap-time $hold-time z @medialy)
/ (tap-hold $tap-time $hold-time / @medialy)
)
;; Chord definitions. Kind of weird to read as a layperson
;; so I provided sufficient comments for general understanding.
(defchords ch $chord-time
(w ) w ;; W => W
( e) e ;; E => E
2026-04-04 19:21:49 -04:00
(w e) XX ;; W + E => Enter
(i ) i ;; I => I
( o) o ;; O => O
2026-04-04 19:21:49 -04:00
(i o) XX ;; I + O =>
(s ) @s ;; S => S
( d) @d ;; D => D
2026-04-04 19:21:49 -04:00
(s d) ret ;; S + D =>
(f ) @f
(f d) tab ;; F + D = Tab
(j ) @j
(j k) esc ;; J + K => Escape
(k ) @k ;; K => K (See defalias)
( l) @l ;; L => L (See defalias)
2026-04-04 19:21:49 -04:00
(k l) bspc ;; K + L => Escape
;; Cmd => Hyper Key, Cmd × 2 => Cmd
(lmet ) (tap-dance $tap-time ((multi lsft lctl lalt lmet) lmet))
( rmet) (tap-dance $tap-time ((multi lsft lctl lalt lmet) lmet))
#|
Put simply, the below line allows for toggling a no-bind
layer for when you may require a standard layout (such as
playing Street Fighter, Counter Strike, etc.) by pressing
both Meta keys at the same time. You can toggle back to the
base layer by holding both Meta keys at the same time, as to allow
for normal functionality when holding either key down for a shortcut.
|#
(lmet rmet) (tap-hold $tap-time $hold-time @normie (layer-switch base))
)
;; Base layer with all binds enabled
(deflayer base
@caps
q @chw @che r t y u @chi @cho p
2026-04-04 19:25:35 -04:00
@a @chs @chd @chf @g @h @chj @chk @chl @scln
@z x c @v b n @m , . @/
@ch_lmet @spc @ch_rmet
)
;; Navigation layer
(deflayer nav
_
_ (movemouse-up 3 3) _ _ _ _ mlft mrgt pgup pgdn
(movemouse-left 3 3) (movemouse-down 3 3) (movemouse-right 3 3) _ home left down up right end
_ _ _ _ _ _ _ _ _ _
_ _ _
)
;; Numpad Layer
(deflayer num
_
_ _ _ _ _ _ 7 8 9 _
_ _ _ _ _ _ 4 5 6 0 _
_ _ _ _ _ 1 2 3 _
_ _ _
)
;; Function key layer
(deflayer fn
_
f1 f2 f3 f4 _ _ _ _ _ _
f5 f6 f7 f8 _ _ _ _ _ _ _
f9 f10 f11 f12 _ _ _ _ _
_ _ _
)
;; Symbol layer
(deflayer symbol
_
S-1 S-2 S-3 S-4 S-5 S-6 S-7 S-8 S-9 S-0
- S-= S-[ S-] [ ] S-` S-scln S-\ \
= _ _ ` _ S-- _ _ ' S-'
_ _ _
)
;; Aformentioned standard layer with combo binds for toggling back
;; to base layer.
(deflayer norm
esc
q w e r t y u i o p
a s d f g h j k l scln
z x c v b n m , . /
@ch_lmet spc @ch_rmet
)
;; Media layer
(deflayer md
_
_ _ _ _ _ _ _ _ _ _
prev pp next mute vold volu brdn brup ins del
_ _ _ _ _ _ _ _ _ _
_ _ _
)