-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththinkpad.kbd
102 lines (87 loc) · 3.33 KB
/
thinkpad.kbd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#|
Run this config with
sudo ~/local/bin/kanata --cfg ~/personal/configs/thinkpad.kbd
|#
;; `defvar` allows to declare commonly-used values with a name, so they don't
;; have to be repeated through the configuration. They are recalled with `$`.
(defvar
tap-timeout 200
hold-timeout 250
tt $tap-timeout
ht $hold-timeout
)
;; `defalias` allows to define a shorthand of a more complex value than a simple
;; variable. They can be recalled later with `@`. Those aliases have the name of
;; a key that we want to remap, and the value of what we want them to be
;; remapped to.
(defalias
cap (tap-hold $tt $ht esc (layer-toggle arrows))
a (tap-hold $tt $ht a lmet)
s (tap-hold $tt $ht s lalt)
d (tap-hold $tt $ht d lctl)
f (tap-hold $tt $ht f lsft)
j (tap-hold $tt $ht j rsft)
k (tap-hold $tt $ht k rctl)
l (tap-hold $tt $ht l lalt)
x (tap-hold $tt $ht ñ rmet)
quot (tap-hold $tt $ht ' RA-')
btik (tap-hold $tt $ht ` RA-`)
)
#|
One defcfg entry may be added, which is used for configuration key-pairs. These
configurations change kanata's behaviour at a more global level than the other
configuration entries.
|#
(defcfg
#|
This configuration will process all keys pressed inside of kanata, even if
they are not mapped in defsrc. This is so that certain actions can activate
at the right time for certain input sequences. By default, unmapped keys are
not processed through kanata due to a Windows issue related to AltGr. If you
use AltGr in your keyboard, you will likely want to follow the simple.kbd
file while unmapping lctl and ralt from defsrc.
|#
process-unmapped-keys yes
;; This is the same as in the example `kanata.kdb` file, and it's exactly the
;; same device as in my thinkpad. The same example file mentions paths in
;; /dev/input/by-id being supposedly more reliable, but neither the author nor
;; me can find a keyboard there in our computers.
linux-dev /dev/input/by-path/platform-i8042-serio-0-event-kbd
)
;; Find which key it is with `evtest`
(deflocalkeys-linux
ñ 39
;; This seemed like necessary, given that this keys are "weird", and not
;; letters, but seems it works regardless. It's only for names not in non-US
;; keyboards, but this is not the case for this ones.
;; Honestly, this makes me wonder if I could have done by using `;` as key
;; name, instead of having to define `ñ`.
;; ' 40
;; ` 41
)
;; Defines the source of keys to remap. In minimal cases, it will be just caps
;; lock and escape, for example. In "complete" cases, the whole keyboard.
;; In this case, it's mostly just the home row, for home-row-modifiers, plus
;; escape and caps lock. Remember that how the text is aligned is purely for our
;; convenience. The definition is just a list, and what matters is the position
;; on the list (0 for `esc`, 1 for `caps`, etc.).
(defsrc
esc
` y u i o
caps
a s d f g h j k l ñ '
)
;; The first layer is what is active by default. It can have any name.
(deflayer default
caps
@btik y u i o
@cap
@a @s @d @f g h @j @k @l @x @quot
)
(deflayer arrows
_
_ home pgdn pgup end
_
_ _ _ _ _ left down up rght _ _
)
;; vim: filetype=lisp commentstring=;;%s ts=2 sw=2: