1
0
mirror of https://github.com/balkian/balkian.github.com.git synced 2024-12-26 10:18:13 +00:00
balkian.github.com/post/2023-01-20-kanata/index.html
2023-01-23 08:55:17 +01:00

385 lines
22 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Balkian&#39;s site - WELCOME</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../../font-awesome/css/all.css">
<link rel="stylesheet" media="only screen" href="../../css/main.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300|Comfortaa' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="container" class="container">
<div id="contentwrapper">
<div id="content">
<header id="header">
<ul class="navbar" id="navbar">
<a href="../../">
<li >
<i class="fa fa-home fa-large"></i>
</li></a>
<a href="../../post/"><li class='' >Blog
</li></a>
<a href="../../tags/"><li class='' >Tags
</li></a>
<a href="../../cheatsheet/"><li class='' >Cheatsheets
</li></a>
<a href="../../project/"><li class='' >Projects
</li></a>
<a href="../../page/todo/"><li class='' >To-do
</li></a>
<a href="//jfernando.es" target="_blank"><li>
CV
</li></a>
<a href="../../search"><li>
<i class="fa fa-search"></i>
</li></a>
</ul>
</header>
<h2>Kanata: advanced keyboard configuration</h2>
<span class="date">2023/01/20</span>
<span>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/logitech'><span class="label">logitech</span></a>
<a class="tag" href='../../tags/keyboard'><span class="label">keyboard</span></a>
<a class="tag" href='../../tags/layout'><span class="label">layout</span></a>
<a class="tag" href='../../tags/rust'><span class="label">rust</span></a>
</span>
<h3></h3>
<p><a href="https://github.com/jtroo/kanata/">Kanata</a> is a software keyboard remapper that aims to improve keyboard comfort and usability with advanced customization.
Keyboard remappers are a good alternative to running a custom keyboard with QMK/ZMK, and have two main advantages: they work on any keyboard, and you can configure them to launch any command or program you want, not just key presses.
On the other hand, you need to configure them on every PC/OS you&rsquo;re using your keyboard with, and all the processing is done on software on top of the OS, so there may be glitches and performance issues.</p>
<p>The project was inspired by the more popular <a href="https://github.com/kmonad/kmonad">KMonad</a>, and the author cites some of the <a href="https://github.com/jtroo/kanata/blob/main/docs/kmonad_comparison.md">differences</a>.
Both projects use a very similar configuration format based on lisp.
The configuration consists of a set of general options, a base key configuration, a series of layers, and macros that can be used within those layers.
<a href="https://github.com/jtroo/kanata/blob/main/cfg_samples/kanata.kbd">Here&rsquo;s a very complete config that serves as documentation</a>.</p>
<p>One big disadvantage of the lispy configuration is that you need to specify your hardware layout/all your keys, and repeat that every time you define a new layer.
The result visually maps to your keyboard, but can be very verbose/big if you need really few changes.</p>
<p><a href="https://github.com/rvaiya/keyd/">Keyd</a> is another alternative with a more declarative configuration format, which might lend itself to smaller.</p>
<p>For now I&rsquo;m just trying it out, and getting a feel for using fewer keys before I build my own ZMK keyboard.
I particularly like the option of using mod-keys on the home row (e.g., having A work as a CTRL when held).
Mod-tap, tap-dancing and the like are very common techniques in sub-40% layouts, where there simply aren&rsquo;t enough keys for all the letters and symbols.
In a regular-sized keyboard, these techniques can also help you stay on the home row and type more comfortably.
At least, that&rsquo;s the idea.
We&rsquo;ll see if I like it enough to stick with it.</p>
<p>For now, here&rsquo;s my very simple config:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">44
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">45
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">46
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">47
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">48
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">49
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">50
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">51
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">52
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">53
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">54
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">55
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">56
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">57
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">58
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">59
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">60
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">61
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">62
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">63
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">64
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">65
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">66
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">67
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">68
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">69
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">70
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">71
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">72
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">73
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">74
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">75
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">76
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">77
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">78
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">79
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">80
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-lisp" data-lang="lisp">(defcfg
<span style="color:#75715e">;; Your keyboard device will likely differ from this.</span>
linux-dev /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse
<span style="color:#75715e">;; Windows doesn&#39;t need any input/output configuration entries; however, there</span>
<span style="color:#75715e">;; must still be a defcfg entry. You can keep the linux-dev entry or delete</span>
<span style="color:#75715e">;; it and leave it empty.</span>
)
(defsrc
grv <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">2</span> <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">4</span> <span style="color:#ae81ff">5</span> <span style="color:#ae81ff">6</span> <span style="color:#ae81ff">7</span> <span style="color:#ae81ff">8</span> <span style="color:#ae81ff">9</span> <span style="color:#ae81ff">0</span> <span style="color:#a6e22e">-</span> <span style="color:#a6e22e">=</span> bspc
tab q w e r <span style="color:#66d9ef">t</span> y u i o p [ ]
caps a s d f g h j k l <span style="color:#75715e">; &#39; ret</span>
lsft \ z x c v b n m <span style="color:#f92672">,</span> <span style="color:#f92672">.</span> <span style="color:#a6e22e">/</span> rsft
lctl lmet lalt spc ralt rmet rctl
)
(deflayer qwerty
grv _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ @warrows _ _ _ _ _ _ _ _ _ _
lctrl @alctrl @slsft @dlalt @flmet _ _ @jrmet @kralt @lrsft @<span style="color:#75715e">;rctrl _ _</span>
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ @smartspace _ _ _
)
(deflayer arrows
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ @flmet _ left down up rght _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ @smartspace _ _ _
)
(deflayer colemak
grv XX XX XX XX XX XX XX XX XX XX XX XX _
tab q w f p b j l u y <span style="color:#75715e">; [ ] </span>
lctrl @alctrl @rlsft @slalt @tlmet g m @nrmet @eralt @irsft @orctrl <span style="color:#f92672">&#39;</span> ret
lsft XX z x c d v k h <span style="color:#f92672">,</span> <span style="color:#f92672">.</span> <span style="color:#a6e22e">/</span> rsft
XX XX XX @smartspace XX XX XX
)
(deflayer magic
_ @clmk @qwerty _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ tab A-tab _ _ _ _ bspc esc _ ret _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
)
(defalias
warrows (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> w (layer-toggle arrows))
alctrl (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> a lctrl)
slsft (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> s lsft)
dlalt (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> d lalt)
flmet (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> f lmet)
jrmet (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> j rmet)
kralt (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> k ralt)
lrsft (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> l rsft)
<span style="color:#75715e">;rctrl (tap-hold 200 200 ; rctrl)</span>
rlsft (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> r lsft)
slalt (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> s lalt)
tlmet (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> <span style="color:#66d9ef">t</span> lmet)
nrmet (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> n rmet)
eralt (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> e ralt)
irsft (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> i rsft)
orctrl (tap-hold <span style="color:#ae81ff">200</span> <span style="color:#ae81ff">200</span> o rctrl)
clmk (layer-switch colemak)
qwerty (layer-switch qwerty)
smartspace (tap-dance <span style="color:#ae81ff">200</span> (
(tap-hold <span style="color:#ae81ff">300</span> <span style="color:#ae81ff">300</span> spc (layer-toggle magic))
(tap-hold <span style="color:#ae81ff">300</span> <span style="color:#ae81ff">300</span> (one-shot <span style="color:#ae81ff">300</span> lalt) spc)
a
))
)
</code></pre></td></tr></table>
</div>
</div>
</div>
<div id="sidebar" class="fixed">
<div id="badge" class="flip-container" ontouchstart="this.classList.toggle('hover');">
<div class="flipper sticky expand">
<div class="front">
<img id="avatar" class="expandx" src="../../img/me.png">
</div>
<div class="back">
<div id="about">
<div class="icons vertical-center">
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-linux"></i></span><span class="explanation">Linux user</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-android"></i></span><span class="explanation">Android dev and user</span></span>
<a href="http://github.com/balkian" target="_blank"><span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-github"></i> </span><span class="explanation">Github user</span></span></a>
<a href="http://gitlab.com/balkian" target="_blank"><span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-gitlab"></i> </span><span class="explanation">GitLab user</span></span></a>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-stack-exchange"></i> </span><span class="explanation">StackExchange fan</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-music"></i> </span><span class="explanation">Music lover</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-film"></i> </span><span class="explanation">Movie fan</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-laptop"></i> </span><span class="explanation">Always on a PC</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-moon"></i> </span><span class="explanation">Night owl</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-terminal"></i></span> <span class="explanation">CLI user</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-flag"></i></span> <span class="explanation">I love languages</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-code"></i> </span> <span class="explanation">I love programming</span></span>
</div>
</div>
</div>
</div>
</div>
<div class="entries">
<h2 class="title">Latest entries</h2>
<dt><a href="../../post/2023-01-20-kanata/">Kanata: advanced keyboard configuration</a></dt>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/logitech'><span class="label">logitech</span></a>
<a class="tag" href='../../tags/keyboard'><span class="label">keyboard</span></a>
<a class="tag" href='../../tags/layout'><span class="label">layout</span></a>
<a class="tag" href='../../tags/rust'><span class="label">rust</span></a>
<dt><a href="../../post/2021-10-30-logitech-mk850/">Logitech MB850 combi in linux</a></dt>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/logitech'><span class="label">logitech</span></a>
<a class="tag" href='../../tags/keyboard'><span class="label">keyboard</span></a>
<a class="tag" href='../../tags/mouse'><span class="label">mouse</span></a>
<dt><a href="../../post/2021-10-29-logitech-mx-keys-mac/">Logitech MX Keys for Mac on Linux</a></dt>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/logitech'><span class="label">logitech</span></a>
<a class="tag" href='../../tags/keyboard'><span class="label">keyboard</span></a>
<dt><a href="../../post/2019-05-01-surface-go/">Linux on the Microsoft Surface Go</a></dt>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/surface-go'><span class="label">surface go</span></a>
<a class="tag" href='../../tags/config'><span class="label">config</span></a>
</div>
</div>
<div class="clear"></div>
</div>
<footer class="pagefooter" role="contentinfo">
<div class="contact">
<p>
J. Fernando Sánchez Rada | balkian
</p>
</div>
<ul id="social">
<li><a href="http://github.com/balkian"><i class="fab fa-github"></i></a></li>
<li><a href="http://lab.gsi.upm.es/balkian"><i class="fab fa-gitlab"></i></a></li>
<li><a href="http://twitter.com/balkian"><i class="fab fa-twitter"></i></a></li>
<li><a href="http://git.sinpapel.es/balkian"><i class="fab fa-git"></i></a></li>
<li><a href="http://linkedin.com/in/jfsanchezrada"><i class="fab fa-linkedin"></i></a></li>
</ul>
<p>
<i class="fab fa-creative-commons"></i> Creative Commons A-SA-NC
</p>
</footer>
</div>
<script src="../../js/jquery-2.0.2.min.js"></script>
</body>
</html>