dotfiles/kmonad/keychron-k2.kbd

206 lines
7.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

;; vim: set filetype=kbd foldmethod=syntax foldlevel=0 foldcolumn=0 et tw=78:
;; ---------------------------------------------------------------------------
;; Keymap for Keychron K2
;; ---------------------------------------------------------------------------
(defcfg
;; input (device-file "/dev/input/by-id/usb-Keychron_Keychron_K2-event-kbd")
;; See https://github.com/kmonad/kmonad/issues/384
input (device-file "/dev/keychron-k2")
output (uinput-sink "keychron-k2-kmonad" "/usr/bin/sleep 1 && /usr/bin/setxkbmap -option compose:ralt")
cmp-seq ralt
cmp-seq-delay 5
fallthrough true
allow-cmd true
)
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 print del
grv 1 2 3 4 5 6 7 8 9 0 - = bspc pgup
tab q w e r t y u i o p [ ] \ pgdn
caps a s d f g h j k l ; ' ret home
lsft z x c v b n m , . / rsft up end
lctl lmet lalt spc ralt rctl left down rght
)
(defalias
qwe (layer-switch qwerty)
mov (tap-hold-next-release 200
(tap-macro caps (layer-add caps))
(layer-toggle movement))
num (layer-switch numbers)
tnum (layer-toggle numbers)
latn (tap-hold-next-release 500 lalt @tnum)
;; lfw (layer-add fullwidth)
;; unfw (layer-rem fullwidth)
sym (layer-toggle symbols)
stm (around met (around alt (around ctl sft)))
meh (tap-hold-next-release 400 spc @stm)
;; Caps layers: semi-perma caps layer that is exited with <caps>, <esc>,
;; or a <spc> - in case of the latter, an actual space is output as well.
cap (tap-macro caps (layer-add caps))
uncap (tap-macro caps (layer-rem caps))
spcap (tap-macro @uncap spc)
;; Home row mods from Miryoku
a (tap-hold-next-release 220 a met)
s (tap-hold-next-release 210 s alt)
d (tap-hold-next-release 180 d ctl)
f (tap-hold-next-release 180 f sft)
j (tap-hold-next-release 180 j sft)
k (tap-hold-next-release 180 k ctl)
l (tap-hold-next-release 210 l alt)
; (tap-hold-next-release 220 ; met)
)
(deflayer qwerty
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 print home
grv 1 2 3 4 5 6 7 8 9 0 - = bspc del
tab q w e r t y u i o p [ ] \\ pgup
@mov @a @s @d @f g h @j @k @l @; ' ret pgdn
lsft z x c v b n m , . / rsft up end
lctl lmet @tnum spc ralt lctl left down rght
)
(deflayer movement
@qwe _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@num _ _ _ _ _ home pgdn pgup end _ _ _ _ _
_ _ _ _ _ _ left down up rght _ _ _ _
@uncap _ _ _ _ _ home pgdn pgup end _ _ pgup _
_ _ _ _ _ _ home pgdn end
)
(deflayer caps
@uncap _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ \_ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@uncap _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ @spcap _ _ _ _ _
)
;; (deflayer fullwidth
;; _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
;; _ _ _ _ _
;; _ _ _ _ _
;; _ _ _ _ _ _
;; _ _ _ _ _
;; _ _ _ _ _ @unfw _ _ _
;; )
(deflayer numbers
@qwe _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ * / _ _ _ _ _
_ _ _ _ _ _ _ 7 8 9 - _ _ _ _
@qwe lmet lalt lctl lsft _ . 4 5 6 + _ _ _
_ _ _ _ _ _ 0 1 2 3 . _ _ _
_ _ _ 0 _ _ _ _ _
)
(deflayer symbols
@qwe _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ ! _ _ _ _ _ _ _ _ _ _ _ _ _
_ { _ _ _ _ _ _ _ _ _ _ _ _ _
_ { _ _ _ _ _ _ _ _ _ _ _ _
_ { _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
)
(deflayer template
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
)
(deflayer mods
;; For display purposes, mostly
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ lmet lalt lctl lsft _ _ rsft rctl lalt rmet _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _
)
#|
<hardware-layout>
+---------------------------------------------------------------------------------------------------------+
| This section defines how to export this standard KMonad file to http://www.keyboard-layout-editor.com/ |
| Render with python3 kmonad_dump/kmonad_dump.py keychron-k2.kbd |
+---------------------------------------------------------------------------------------------------------+
!!! Keycap layout and colors
----------------------------
(keycap
numbers _ _
_ qwerty _
mods _ movement
_ _ _
)
(colors
#256329 #000000 #000000
#000000 #000000 #000000
#532529 #000000 #252953
#000000 #000000 #222222
)
!!! Options are based on `defsrc` (a.k.a. Layer 0) keys
-------------------------------------------------------
(options bspc {w:2})
(options tab {w:1.5})
(options \ {w:1.5})
(options caps {w:1.75})
(options ret {w:2.25})
(options lsft {w:2.25})
(options rsft {w:1.75})
(options lctl {w:1.25})
(options lmet {w:1.25})
(options lalt {w:1.25})
(options rctl {x:1})
(options spc {w:6.25})
(options f {n:true})
(options j {n:true})
!!! Override or assign labels
-----------------------------
(label esc Esc)
(label @qwe Qwerty)
(label @mov Caps)
(label ret Enter)
(label @a A)
(label @s S)
(label @d D)
(label @f F)
(label @j J)
(label @k K)
(label @l L)
(label @; ;)
(label left ←)
(label nlck NumLk)
(label print Print)
(label home Home)
(label end End)
(label tab Tab)
(label bspc Backspace)
!!! Add some notes
------------------
(description
Keychron K2 layout
)
</hardware-layout>
|#