1
0

kanata.kbd 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ;; Kanata configuration for MacBook Air M2 with advanced home row modifiers
  2. ;; Uses tap-hold-release-keys with bilateral combinations for better accuracy
  3. (defcfg
  4. process-unmapped-keys yes
  5. macos-dev-names-include (
  6. "Apple Internal Keyboard / Trackpad"
  7. )
  8. macos-dev-names-exclude (
  9. "Voyager"
  10. "YubiKey OTP+FIDO+CCID"
  11. )
  12. )
  13. (defvar
  14. ;; Timing values - adjust based on your typing speed
  15. tap-repress-timeout 100
  16. hold-timeout 200
  17. tt $tap-repress-timeout
  18. ht $hold-timeout
  19. ;; Define which keys are on each hand for bilateral combinations
  20. left-hand-keys (q w e r t a s d f g z x c v b)
  21. right-hand-keys (y u i o p h j k l ; n m , . /)
  22. lhk $left-hand-keys
  23. rhk $right-hand-keys
  24. )
  25. (defsrc
  26. ;; esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
  27. f1 f2 f10 f11 f12
  28. ;; grv 1 2 3 4 5 6 7 8 9 0 - = bspc
  29. ;; tab q w e r t y u i o p [ ] \
  30. tab q w e r t y u i o p
  31. ;; caps a s d f g h j k l ; ' ret
  32. caps a s d f g h j k l ;
  33. ;; lsft z x c v b n m , . / rsft
  34. z x c v b n m , . /
  35. ;; fn lctl lalt lmet spc rmet ralt left down up rght
  36. lmet spc rmet
  37. )
  38. ;; base layer with home row modifiers and proper media keys
  39. (deflayer base
  40. brdn brup mute vold volu
  41. tab q w e r t y u i o p
  42. @esc @a @s @d @f g h @j @k @l @;
  43. z x c @v b n m , . /
  44. @lmet spc ret
  45. )
  46. ;; symbols layer
  47. (deflayer symbols
  48. brdn brup mute vold volu
  49. tab S-1 S-2 S-3 S-4 S-5 S-6 S-7 S-[ S-] S-8
  50. @esc ` S-- - S-= = S-` S-\ S-9 S-0 '
  51. z x c tab b / \ [ ] S-/
  52. lmet spc ret
  53. )
  54. ;; numpad layer
  55. (deflayer numbers
  56. brdn brup mute vold volu
  57. tab q w e r t S-8 7 8 9 -
  58. @esc @a @s , . g / 4 5 6 S-=
  59. z x c v b = 1 2 3 ret
  60. lmet spc 0
  61. )
  62. ;; layer without modifiers - used temporarily when tapping home row keys
  63. (deflayer nomods
  64. brdn brup mute vold volu
  65. tab q w e r t y u i o p
  66. esc a s d f g h j k l ;
  67. z x c v b n m , . /
  68. lmet spc ret
  69. )
  70. ;; mouse and arrow key layer
  71. (deflayer mouse
  72. brdn brup mute vold volu
  73. tab q w e r t y u i o p
  74. @esc @a @s @d @f g left down up right ;
  75. z x c v b n m , . /
  76. lmet spc ret
  77. )
  78. (deffakekeys
  79. to-base (layer-switch base)
  80. )
  81. (defalias
  82. spotlight (multi lmet spc) ;; Command + Space
  83. ;; Tap behavior: switch to nomods layer temporarily, then back to base
  84. tap (multi
  85. (layer-switch nomods)
  86. (on-idle-fakekey to-base tap 20)
  87. )
  88. ;; Home row modifiers with bilateral combinations
  89. ;; Left hand keys with LEFT-side modifiers
  90. a (tap-hold-release-keys $tt $ht (multi a @tap) lmet $rhk)
  91. s (tap-hold-release-keys $tt $ht (multi s @tap) lalt $rhk)
  92. d (tap-hold-release-keys $tt $ht (multi d @tap) lctl $rhk)
  93. f (tap-hold-release-keys $tt $ht (multi f @tap) lsft $rhk)
  94. ;; Right hand keys with RIGHT-side modifiers
  95. j (tap-hold-release-keys $tt $ht (multi j @tap) rsft $lhk)
  96. k (tap-hold-release-keys $tt $ht (multi k @tap) rctl $lhk)
  97. l (tap-hold-release-keys $tt $ht (multi l @tap) ralt $lhk)
  98. ; (tap-hold-release-keys $tt $ht (multi ; @tap) rmet $lhk)
  99. v (tap-hold $tt $ht (multi v @tap) (layer-toggle numbers))
  100. esc (tap-hold $tt $ht (multi esc @tap) (layer-toggle mouse))
  101. lmet (layer-toggle symbols)
  102. )