Skip to content

Instantly share code, notes, and snippets.

@andrewvmail
Created March 8, 2023 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewvmail/35461e024f9e84c455d516c4392ce840 to your computer and use it in GitHub Desktop.
Save andrewvmail/35461e024f9e84c455d516c4392ce840 to your computer and use it in GitHub Desktop.
kanata.kbd
(defcfg
process-unmapped-keys yes
danger-enable-cmd yes
)
(defsrc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet rctl
)
;; The first layer defined is the layer that will be active by default when
;; kanata starts up. This layer is the standard QWERTY layout except for the
;; backtick/grave key (@grl) which is an alias for a tap-hold key.
;;
;; There are currently a maximum of 25 layers allowed.
(deflayer qwerty
@grl 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
caps @arr s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet rctl
)
;; The dvorak layer remaps the keys to the dvorak layout. In addition there is
;; another tap-hold key: @cap. This key retains caps lock functionality when
;; quickly tapped but is read as left-control when held.
(deflayer dvorak
@grl 1 2 3 4 5 6 7 8 9 0 [ ] bspc
tab ' , . p y f g c r l / = \
@cap @arr o e u i d h t n s - ret
lsft ; q j k x b m w v z rsft
lctl lmet lalt spc ralt rmet rctl
)
(deflayer arrows
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ left down up rght _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
)
;; defalias is used to declare a shortcut for a more complicated action to keep
;; the deflayer declarations clean and aligned. The alignment in deflayers is not
;; necessary, but is strongly recommended for ease of understanding visually.
;;
;; Aliases are referred to by `@<alias_name>`.
(defalias
;; tap: backtick (grave), hold: toggle layer-switching layer while held
grl (tap-hold 200 200 grv (layer-toggle layers))
arr (tap-hold 200 200 a (layer-toggle arrows))
;; layer-switch changes the base layer.
dvk (layer-switch dvorak)
qwr (layer-switch qwerty)
;; tap for capslk, hold for lctl
cap (tap-hold 200 200 caps lctl)
bad (tap-hold 200 200 caps lctl)
)
;; The `lrld` action stands for "live reload". This will re-parse everything
;; except for linux-dev, meaning you cannot live reload and switch keyboard
;; devices.
;;
;; The keys 1 and 2 switch the base layer to qwerty and dvorak respectively.
;;
;; Apart from the layer switching and live reload, all other keys are the
;; underscore _ which means "transparent". Transparent means the base layer
;; behaviour is used when pressing that key.
(deflayer layers
_ @qwr @dvk lrld _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment