diff options
author | Akshay <[email protected]> | 2022-08-28 14:52:48 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-08-28 14:52:48 +0100 |
commit | efc4149c10f249bd92b02dfd4041378763baeb66 (patch) | |
tree | 4350bb5ebe532eb379e9feedcb440b76be9016e1 /posts | |
parent | 9698183d180a470329d77304dc8e87d976fa753d (diff) |
new post: programming on 34 keys
Diffstat (limited to 'posts')
-rw-r--r-- | posts/programming_on_34_keys.md | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/posts/programming_on_34_keys.md b/posts/programming_on_34_keys.md new file mode 100644 index 0000000..15610d6 --- /dev/null +++ b/posts/programming_on_34_keys.md | |||
@@ -0,0 +1,159 @@ | |||
1 | Minimizing your keyboard layout is a slippery slope. A few | ||
2 | months ago, I built the | ||
3 | [Ferricy](https://github.com/icyphox/ferricy), a | ||
4 | 34-key-split-ortho-ergo keyboard. The Ferricy is a fork of | ||
5 | the [Ferris Sweep MX | ||
6 | Bling](https://github.com/davidphilipbarr/Sweep/tree/main/Sweep%20Bling%20MX). | ||
7 | |||
8 | ![The Ferricy, designed by [icyphox](https://icyphox.sh)](https://u.peppe.rs/otz.jpg) | ||
9 | |||
10 | |||
11 | My daily use consists of a bit of prose and a lot of | ||
12 | program, my layout has evolved accordingly. | ||
13 | |||
14 | # Base Layer | ||
15 | |||
16 | ![Colemak with no mods](https://u.peppe.rs/base.png) | ||
17 | |||
18 | The base layer contains alphabets, four symbols and four | ||
19 | whitespace keys: | ||
20 | |||
21 | - Alphas: Stock Colemak, with no modifications whatsoever | ||
22 | - Symbols: `. , / ;` | ||
23 | - Whitespace: tab, space, enter, backspace (from left to | ||
24 | right) | ||
25 | |||
26 | # Layers | ||
27 | |||
28 | Keyboard input is complex and it is impossible to skirt | ||
29 | around it. You can either use a keyboard with enough keys to | ||
30 | supply all possible inputs (a mechanical burden), or you can | ||
31 | use firmware to supply all possible inputs (a cognitive | ||
32 | burden). Layers are a cognitive burden. | ||
33 | |||
34 | I use 3 layers, heavily inspired by | ||
35 | [Miryoku](https://github.com/manna-harbour/miryoku), but | ||
36 | tuned for programming. Excluding the base Colemak layer: | ||
37 | |||
38 | - `NAV`: activated on holding `space` (left thumb) | ||
39 | - `NUM`: activated on holding `tab` (left thumb) | ||
40 | - `SYM`: activated on holding `enter` (right thumb) | ||
41 | |||
42 | ## The `NAV` Layer | ||
43 | |||
44 | As the name suggests, this layer is focused on navigation. | ||
45 | Arrow keys and the likes. | ||
46 | |||
47 | ![`NAV`, on holding `space`](https://u.peppe.rs/nav.png) | ||
48 | |||
49 | Using Vim and Colemak means you lose out on HJKL navigation. | ||
50 | However, on activating the `NAV` layer, the right home-row is | ||
51 | converted into arrow keys. In essence, by holding space, I | ||
52 | can navigate Vim with the home-row, or Firefox, or my PDF | ||
53 | reader. I no longer need to look for software that allows | ||
54 | Vim navigation keys, because it is baked into the firmware! | ||
55 | |||
56 | My Vim motions are not limited to HJKL. In fact, my Vim | ||
57 | motions are rarely HJKL. I tend to use `}` (next paragraph) | ||
58 | and `)` (next sentence) more often. As a result, these have | ||
59 | found their way into my `NAV` layer, over the likes of | ||
60 | `PgDown` and `End`. Having brackets at my index and middle | ||
61 | fingers is nice for programming too. | ||
62 | |||
63 | ## The `SYM` Layer | ||
64 | |||
65 | ![`SYM`, on holding `enter`](https://u.peppe.rs/sym.png) | ||
66 | |||
67 | This layer contains all the symbols that you would find by | ||
68 | hitting `Shift` and a key on the number row. Probably | ||
69 | noteworthy to Vim users: the symbols are arranged in the | ||
70 | form of a mirrored numpad for exactly one reason: to move | ||
71 | `$` to the left of `^`. It has always annoyed me that `$` | ||
72 | moves the cursor to the end of the line and `^` moves it to | ||
73 | the beginning, but their position on a typical number row | ||
74 | are reversed, 4 comes before 6. | ||
75 | |||
76 | ## The `NUM` layer | ||
77 | |||
78 | ![`NUM`, on holding `tab`](https://u.peppe.rs/num.png) | ||
79 | |||
80 | Another deviation from Miryoku, the numpad just feels _right_ | ||
81 | on my _right_ hand. | ||
82 | |||
83 | # ZMK Combos | ||
84 | |||
85 | If you have been paying close attention, you might have | ||
86 | noticed that `escape` didn't make it to any layer. `escape` | ||
87 | is too crucial to put on a non-base layer, but at the same | ||
88 | time, not as important to deserve a place on the base layer. | ||
89 | That is where ZMK's combos come in. Combos let you tap any | ||
90 | number of keys, and combine them to form a single key. I | ||
91 | have combos set up for underscore, minus, escape and | ||
92 | caps-word (more on caps-word later): | ||
93 | |||
94 | ![Combos are almost piano-like](https://u.peppe.rs/combos.png) | ||
95 | |||
96 | # Home-row Mods | ||
97 | |||
98 | Inherited from Miryoku, I have home-row mods for activating | ||
99 | `Super`, `Alt`, `Shift`, `Ctrl` and `Hyper` (`Ctrl + Shift + | ||
100 | Alt + Super`). The idea is to send `T` on tap and `Ctrl` on | ||
101 | hold. Home-row mods are fairly popular, so I'll not go into | ||
102 | the details. | ||
103 | |||
104 | ![Super, Alt, Shift, Ctrl, Hyper; on the left half, and | ||
105 | mirrored on the right half](https://u.peppe.rs/homerow.png) | ||
106 | |||
107 | `Hyper` bridges the gap between firmware and software. You | ||
108 | can never configure key combination that, opens Firefox, for | ||
109 | example, through firmware alone. However, with the `Hyper` | ||
110 | key, and some `sxhkd` magic, you can emulate that. Pressing | ||
111 | `Hyper + F` on a keyboard is just two keys, but the key | ||
112 | codes sent are `Ctrl + Shift + Alt + Super + F`. That key | ||
113 | combination is not intercepted by any application as a | ||
114 | shortcut, except for the following `sxhkd` stanza: | ||
115 | |||
116 | ```bash | ||
117 | super + alt + shift + ctrl + f | ||
118 | xdotool search "Mozilla Firefox" windowactivate | ||
119 | ``` | ||
120 | |||
121 | Alternatively, you can intercept unused `F` keys: `F13` | ||
122 | through `F24`. | ||
123 | |||
124 | Home-row mods are mirrored on each half because it would be | ||
125 | impossible to hit `Ctrl + T` if not; they lie on the same | ||
126 | key. | ||
127 | |||
128 | # Caps-word | ||
129 | |||
130 | Caps-word is a clever caps-lock, built into ZMK. Typing out | ||
131 | constants such as `PORT` with home-row mods would look like | ||
132 | this: | ||
133 | |||
134 | - hold `e` (shift) on left hand, and tap `p` on right hand | ||
135 | - hold `e` (shift) on left hand, and tap `o` on right hand | ||
136 | - hold `s` (shift) on right hand, and tap `r` on left hand | ||
137 | - hold `s` (shift) on right hand, and tap `t` on left hand | ||
138 | |||
139 | This hold-alternate-hold dance gets tiring quickly. With | ||
140 | caps-word, however: | ||
141 | |||
142 | - toggle `caps_word` | ||
143 | - type out `p`, `o`, `r`, `t` | ||
144 | - hit a _break_ character (space, enter will do) | ||
145 | - continue | ||
146 | |||
147 | Caps-word automatically disables capitalization upon | ||
148 | encountering a breaking character, (which are space, enter | ||
149 | or any modifier, by default) right in the firmware! | ||
150 | |||
151 | # Findings | ||
152 | |||
153 | 34-keys has been reasonably comfortable to use, for both | ||
154 | prose and program. My palms do not move across the desk at | ||
155 | all, as I reach for keys. I mostly write Rust and Bash, and | ||
156 | my layout has evolved to accomodate special characters from | ||
157 | their grammars (angled brackets and hyphens, specifically). | ||
158 | If you are on a similar journey, I would suggest focusing on | ||
159 | accuracy and comfort over speed. Speed comes with time. | ||