aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/programming_on_34_keys/index.html
blob: 37ccfe6db1721f1998baf69f28d38d355cee8da6 (plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="/style.css">
    <link rel="stylesheet" href="/syntax.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1">
    <meta content="#ffffff" name="theme-color">
    <meta name="HandheldFriendly" content="true">
    <meta property="og:title" content="Programming On 34 Keys">
    <meta property="og:type" content="website">
    <meta property="og:description" content="a static site {for, by, about} me ">
    <meta property="og:url" content="https://peppe.rs">
    <link rel="icon" type="image/x-icon" href="/favicon.png">
    <title>Programming On 34 Keys · peppe.rs</title>
    <body>
      <div class="posts">
        <div class="post">
          <a href="/" class="post-end-link">Home</a>
          <span>/</span>
          <a href="/posts" class="post-end-link">Posts</a>
          <span>/</span>
          <a class="post-end-link">Programming On 34 Keys</a>
          <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/programming_on_34_keys.md
">View Raw</a>
          <div class="separator"></div>
          <div class="date">
            28/08 — 2022
            <div class="stats">
              <span class="stats-number">
                63.54
              </span>
              <span class="stats-unit">cm</span>
              &nbsp
              <span class="stats-number">
                6.2
              </span>
              <span class="stats-unit">min</span>
            </div>
          </div>
          <h1>
            Programming On 34 Keys
          </h1>
          <div class="post-text">
            <p>Minimizing your keyboard layout is a slippery slope. A few months
ago, I built the <a
href="https://github.com/icyphox/ferricy">Ferricy</a>, a
34-key-split-ortho-ergo keyboard. The Ferricy is a fork of the <a
href="https://github.com/davidphilipbarr/Sweep/tree/main/Sweep%20Bling%20MX">Ferris
Sweep MX Bling</a>.</p>
<figure>
<img src="https://u.peppe.rs/otz.jpg"
alt="The Ferricy, designed by icyphox" />
<figcaption aria-hidden="true">The Ferricy, designed by <a
href="https://icyphox.sh">icyphox</a></figcaption>
</figure>
<p>My daily use consists of a bit of prose and a lot of program, my
layout has evolved accordingly.</p>
<h1 id="base-layer">Base Layer</h1>
<figure>
<img src="https://u.peppe.rs/base.png" alt="Colemak with no mods" />
<figcaption aria-hidden="true">Colemak with no mods</figcaption>
</figure>
<p>The base layer contains alphabets, four symbols and four whitespace
keys:</p>
<ul>
<li>Alphas: Stock Colemak, with no modifications whatsoever</li>
<li>Symbols: <code>. , / ;</code></li>
<li>Whitespace: tab, space, enter, backspace (from left to right)</li>
</ul>
<h1 id="layers">Layers</h1>
<p>Keyboard input is complex and it is impossible to skirt around it.
You can either use a keyboard with enough keys to supply all possible
inputs (a mechanical burden), or you can use firmware to supply all
possible inputs (a cognitive burden). Layers are a cognitive burden.</p>
<p>I use 3 layers, heavily inspired by <a
href="https://github.com/manna-harbour/miryoku">Miryoku</a>, but tuned
for programming. Excluding the base Colemak layer:</p>
<ul>
<li><code>NAV</code>: activated on holding <code>space</code> (left
thumb)</li>
<li><code>NUM</code>: activated on holding <code>tab</code> (left
thumb)</li>
<li><code>SYM</code>: activated on holding <code>enter</code> (right
thumb)</li>
</ul>
<h2 id="the-nav-layer">The <code>NAV</code> Layer</h2>
<p>As the name suggests, this layer is focused on navigation. Arrow keys
and the likes.</p>
<figure>
<img src="https://u.peppe.rs/nav.png" alt="NAV, on holding space" />
<figcaption aria-hidden="true"><code>NAV</code>, on holding
<code>space</code></figcaption>
</figure>
<p>Using Vim and Colemak means you lose out on HJKL navigation. However,
on activating the <code>NAV</code> layer, the right home-row is
converted into arrow keys. In essence, by holding space, I can navigate
Vim with the home-row, or Firefox, or my PDF reader. I no longer need to
look for software that allows Vim navigation keys, because it is baked
into the firmware!</p>
<p>My Vim motions are not limited to HJKL. In fact, my Vim motions are
rarely HJKL. I tend to use <code>}</code> (next paragraph) and
<code>)</code> (next sentence) more often. As a result, these have found
their way into my <code>NAV</code> layer, over the likes of
<code>PgDown</code> and <code>End</code>. Having brackets at my index
and middle fingers is nice for programming too.</p>
<h2 id="the-sym-layer">The <code>SYM</code> Layer</h2>
<figure>
<img src="https://u.peppe.rs/sym.png" alt="SYM, on holding enter" />
<figcaption aria-hidden="true"><code>SYM</code>, on holding
<code>enter</code></figcaption>
</figure>
<p>This layer contains all the symbols that you would find by hitting
<code>Shift</code> and a key on the number row. Probably noteworthy to
Vim users: the symbols are arranged in the form of a mirrored numpad for
exactly one reason: to move <code>$</code> to the left of
<code>^</code>. It has always annoyed me that <code>$</code> moves the
cursor to the end of the line and <code>^</code> moves it to the
beginning, but their position on a typical number row are reversed, 4
comes before 6.</p>
<h2 id="the-num-layer">The <code>NUM</code> layer</h2>
<figure>
<img src="https://u.peppe.rs/num.png" alt="NUM, on holding tab" />
<figcaption aria-hidden="true"><code>NUM</code>, on holding
<code>tab</code></figcaption>
</figure>
<p>Another deviation from Miryoku, the numpad just feels <em>right</em>
on my <em>right</em> hand.</p>
<h1 id="zmk-combos">ZMK Combos</h1>
<p>If you have been paying close attention, you might have noticed that
<code>escape</code> didn’t make it to any layer. <code>escape</code> is
too crucial to put on a non-base layer, but at the same time, not as
important to deserve a place on the base layer. That is where ZMK’s
combos come in. Combos let you tap any number of keys, and combine them
to form a single key. I have combos set up for underscore, minus, escape
and caps-word (more on caps-word later):</p>
<figure>
<img src="https://u.peppe.rs/combos.png"
alt="Combos are almost piano-like" />
<figcaption aria-hidden="true">Combos are almost piano-like</figcaption>
</figure>
<h1 id="home-row-mods">Home-row Mods</h1>
<p>Inherited from Miryoku, I have home-row mods for activating
<code>Super</code>, <code>Alt</code>, <code>Shift</code>,
<code>Ctrl</code> and <code>Hyper</code>
(<code>Ctrl + Shift + Alt + Super</code>). The idea is to send
<code>T</code> on tap and <code>Ctrl</code> on hold. Home-row mods are
fairly popular, so I’ll not go into the details.</p>
<figure>
<img src="https://u.peppe.rs/homerow.png"
alt="Super, Alt, Shift, Ctrl, Hyper; on the left half, and mirrored on the right half" />
<figcaption aria-hidden="true">Super, Alt, Shift, Ctrl, Hyper; on the
left half, and mirrored on the right half</figcaption>
</figure>
<p><code>Hyper</code> bridges the gap between firmware and software. You
can never configure key combination that, opens Firefox, for example,
through firmware alone. However, with the <code>Hyper</code> key, and
some <code>sxhkd</code> magic, you can emulate that. Pressing
<code>Hyper + F</code> on a keyboard is just two keys, but the key codes
sent are <code>Ctrl + Shift + Alt + Super + F</code>. That key
combination is not intercepted by any application as a shortcut, except
for the following <code>sxhkd</code> stanza:</p>
<div class="sourceCode" id="cb1"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">super</span> + alt + shift + ctrl + f</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>  <span class="ex">xdotool</span> search <span class="st">&quot;Mozilla Firefox&quot;</span> windowactivate</span></code></pre></div>
<p>Alternatively, you can intercept unused <code>F</code> keys:
<code>F13</code> through <code>F24</code>.</p>
<p>Home-row mods are mirrored on each half because it would be
impossible to hit <code>Ctrl + T</code> if not; they lie on the same
key.</p>
<h1 id="caps-word">Caps-word</h1>
<p>Caps-word is a clever caps-lock, built into ZMK. Typing out constants
such as <code>PORT</code> with home-row mods would look like this:</p>
<ul>
<li>hold <code>e</code> (shift) on left hand, and tap <code>p</code> on
right hand</li>
<li>hold <code>e</code> (shift) on left hand, and tap <code>o</code> on
right hand</li>
<li>hold <code>s</code> (shift) on right hand, and tap <code>r</code> on
left hand</li>
<li>hold <code>s</code> (shift) on right hand, and tap <code>t</code> on
left hand</li>
</ul>
<p>This hold-alternate-hold dance gets tiring quickly. With caps-word,
however:</p>
<ul>
<li>toggle <code>caps_word</code></li>
<li>type out <code>p</code>, <code>o</code>, <code>r</code>,
<code>t</code></li>
<li>hit a <em>break</em> character (space, enter will do)</li>
<li>continue</li>
</ul>
<p>Caps-word automatically disables capitalization upon encountering a
breaking character, (which are space, enter or any modifier, by default)
right in the firmware!</p>
<h1 id="findings">Findings</h1>
<p>34-keys has been reasonably comfortable to use, for both prose and
program. My palms do not move across the desk at all, as I reach for
keys. I mostly write Rust and Bash, and my layout has evolved to
accomodate special characters from their grammars (angled brackets and
hyphens, specifically). If you are on a similar journey, I would suggest
focusing on accuracy and comfort over speed. Speed comes with time.</p>

          </div>
          
    <div class="intro">
        Hi. 
        <div class="hot-links">
            <a href="https://peppe.rs/index.xml" class="feed-button">Subscribe</a>
            <a href="https://liberapay.com/nerdypepper/donate" class="donate-button">Donate</a>
        </div>
        <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p>
        <p>
        I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer.
        I write <a href="https://git.peppe.rs">open-source stuff</a> to pass time. 
        I also design fonts: 
        <a href="https://git.peppe.rs/fonts/scientifica">scientifica</a>, 
        <a href="https://git.peppe.rs/fonts/curie">curie</a>.
        </p>
        <p>Send me a mail at [email protected] or a message at [email protected].</p>
    </div>
    
          <a href="/" class="post-end-link">Home</a>
          <span>/</span>
          <a href="/posts" class="post-end-link">Posts</a>
          <span>/</span>
          <a class="post-end-link">Programming On 34 Keys</a>
          <a class="stats post-end-link" href="https://git.peppe.rs/web/site/plain/posts/programming_on_34_keys.md
">View Raw</a>
        </div>
      </div>
    </body>
</html>