<?xml version="1.0"?>
<rss version="2.0"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Tyler Cipriani: pages tagged keyboard</title>
<link>https://tylercipriani.com/tags/keyboard/</link>
<atom:link href="https://tylercipriani.com/tags/keyboard/index.rss" rel="self" type="application/rss+xml"/>

<description>Tyler Cipriani</description>
<generator>ikiwiki</generator>
<pubDate>Sat, 01 Jul 2017 00:49:09 +0000</pubDate>
<item>
	<title>Toward a More Useful X Keyboard</title>

	<guid isPermaLink="false">https://tylercipriani.com/blog/2015/01/23/toward-a-useful-keyboard-in-x/</guid>

	<link>https://tylercipriani.com/blog/2015/01/23/toward-a-useful-keyboard-in-x/</link>

	<dc:creator>Tyler Cipriani</dc:creator>



	<category>computing</category>

	<category>keyboard</category>

	<category>unicode</category>


	<pubDate>Fri, 23 Jan 2015 00:00:00 +0000</pubDate>
	<dcterms:modified>2017-07-01T00:49:09Z</dcterms:modified>


	<description>&lt;p&gt;I’m not sure when, exactly, it became clear that I was going to spend as much time as necessary perfecting my keyboard configuration. It’s one of those things that you &lt;em&gt;know&lt;/em&gt; you can make absolutely perfect—given enough time and energy. On Linux, when you spend enough time bashing your brain into a topic, you often find your effort rewarded manyfold. This is the hallmark of a professional tool: a tool with which your efficiency increases with your proficiency.&lt;/p&gt;
&lt;p&gt;The way many people first experience a computer is through a point-and-click-style mouse interface. While there are professional tools that prefer a &lt;a href=&quot;http://research.swtch.com/acme&quot;&gt;mouse interface&lt;/a&gt;, and there is &lt;a href=&quot;http://www.loper-os.org/?p=861&quot;&gt;healthy&lt;/a&gt; &lt;a href=&quot;http://99percentinvisible.org/episode/of-mice-and-men/&quot;&gt;debate&lt;/a&gt; about the most appropriate tool for computer interaction, the fact remains: most professional computing and programming is done with a QWERTY keyboard.&lt;/p&gt;
&lt;p&gt;My endless &lt;code&gt;X&lt;/code&gt; keyboard tinkerings have given me the most efficient keyboard configuration I have ever used. This configuration is probably achievable on other platforms; however, on a modern Linux system my configuration only requires one tool that isn’t included with the kernel: &lt;a href=&quot;https://github.com/alols/xcape&quot;&gt;XCape&lt;/a&gt;, which is 500 lines of GPL-licensed C-code—not too shabby overall.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#keymaps&quot;&gt;Keymaps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#autorepeat&quot;&gt;Key Autorepeat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#persist&quot;&gt;Persistence&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&quot;keymaps&quot;&gt;

&lt;/div&gt;
&lt;section id=&quot;keymaps&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Keymaps &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#keymaps&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To start working with keyboard layout the lowest-risk command is &lt;code&gt;setxkbmap(1)&lt;/code&gt;. &lt;code&gt;setxkbmap&lt;/code&gt; temporarily maps the keyboard to use options specified on the command line. Changes will not persist when you restart &lt;code&gt;X&lt;/code&gt; (i.e., log out and log back in). This is a good place to start experimenting with configuration and layouts.&lt;/p&gt;
&lt;p&gt;The options that can be applied with &lt;code&gt;setxkbmap&lt;/code&gt; are found in &lt;code&gt;xkeyboard-config(7)&lt;/code&gt;. For whatever reason, neither my Debian nor Arch box has this man file. I found &lt;a href=&quot;https://web.archive.org/web/20150125024107/http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=xkeyboard-config&amp;amp;ampsect=7&quot;&gt;one copy&lt;/a&gt; online and made sure to snapshot it in the &lt;a href=&quot;https://web.archive.org&quot;&gt;internet archive&lt;/a&gt;—which is a project to which I plan to donate more heavily in the upcoming year.&lt;/p&gt;
&lt;p&gt;To view currently applied options use: &lt;code&gt;setxkbmap -query&lt;/code&gt; which should output something like:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb1&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-1&quot; title=&quot;1&quot;&gt;rules:      evdev&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-2&quot; title=&quot;2&quot;&gt;model:      pc105&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb1-3&quot; title=&quot;3&quot;&gt;layout:     us&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To achieve this with &lt;code&gt;setxkbmap&lt;/code&gt; you would type in your xterm: &lt;code&gt;setxkbmap -model pc105 -layout us&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is a pretty vanilla setup—when you setup your computer and accept the defaults, this is what you get.&lt;/p&gt;
&lt;div id=&quot;altgr-intl&quot;&gt;

&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;altgr-intl&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;AltGr-Intl &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#altgr-intl&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One of the features I find myself using frequently is the &lt;a href=&quot;https://en.wikipedia.org/wiki/AltGr_key&quot;&gt;AltGr&lt;/a&gt; (or &lt;em&gt;Alternate Graphic&lt;/em&gt;) key. I like to be able to type international characters that are often used in English (like “é”) without resorting to using deadkeys or esoteric key-compostability sequences.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb2&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-1&quot; title=&quot;1&quot;&gt;&amp;quot;é&amp;quot; == [Right Alt] + [e]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-2&quot; title=&quot;2&quot;&gt;&amp;quot;ñ&amp;quot; == [Right Alt] + [n]&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb2-3&quot; title=&quot;3&quot;&gt;&amp;quot;ö&amp;quot; == [Right Alt] + [p]&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To enable this simply use the &lt;code&gt;setxkbmap&lt;/code&gt; command:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb3&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb3-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;setxkbmap&lt;/span&gt; -model pc105 -layout us -variant altgr-intl&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;More information about the &lt;em&gt;AltGr-Intl&lt;/em&gt; layout can be found in the &lt;a href=&quot;http://lists.x.org/archives/xorg/2007-July/026534.html&quot;&gt;Xorg Mailing List&lt;/a&gt; (found via &lt;a href=&quot;https://zuttobenkyou.wordpress.com/2011/08/24/xorg-using-the-us-international-altgr-intl-variant-keyboard-layout/&quot;&gt;Shinobu’s Secrets&lt;/a&gt;)&lt;/p&gt;
&lt;/section&gt;
&lt;section id=&quot;xcompose&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;&lt;code&gt;~/.XCompose&lt;/code&gt; &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#xcompose&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Text expansion is awesome. Being able to type a sequence of three characters to dump your public key into IRC is awesome. Or how about &lt;code&gt;ಠ_ಠ&lt;/code&gt;? Being able to express disapproval quickly is what separates our emails from those of animals: it’s why we have civilization.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Compose_key&quot;&gt;compose&lt;/a&gt; (or &lt;em&gt;MultiKey&lt;/em&gt;) key, can be mapped to any number of keys or key combinations (again, see: &lt;a href=&quot;https://web.archive.org/web/20150125024107/http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=xkeyboard-config&amp;amp;ampsect=7&quot;&gt;xkeyboard-config(7)&lt;/a&gt;) I prefer to map my MultiKey to the right Ctrl key:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb4&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb4-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;setxkbmap&lt;/span&gt; -model pc105 -layout us -variant altgr-intl -option compose:rctrl&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To type special symbols or expansions using the compose key, simply hit the compose key (in my case right Ctrl) and then type the additional character for the combination in sequence.&lt;/p&gt;
&lt;p&gt;For instance, to make a degree mark (“°”) I type: &lt;code&gt;[Ctrl]-o-o&lt;/code&gt;; just like I’m typing “oo”, but I hit the right Ctrl key first.&lt;/p&gt;
&lt;p&gt;The real magic of the compose key can be unleashed with the &lt;code&gt;~/.XCompose&lt;/code&gt; file. This is the file into which you can drop your custom key combination mappings that will generate any text output.&lt;/p&gt;
&lt;p&gt;Example expansions for &lt;a href=&quot;https://github.com/thcipriani/dotfiles/blob/master/XCompose&quot;&gt;&lt;code&gt;~/.XCompose&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb5&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-1&quot; title=&quot;1&quot;&gt;# Quick ssh key output&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-2&quot; title=&quot;2&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;k&amp;gt; &amp;lt;e&amp;gt; &amp;lt;y&amp;gt; : &amp;quot;https://gist.github.com/thcipriani/5e95399457da6544a4cb&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-3&quot; title=&quot;3&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-4&quot; title=&quot;4&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;S&amp;gt; &amp;lt;N&amp;gt; &amp;lt;O&amp;gt; &amp;lt;W&amp;gt;     : &amp;quot;❄&amp;quot;   U2603&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-5&quot; title=&quot;5&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;p&amp;gt; &amp;lt;l&amp;gt; &amp;lt;a&amp;gt; &amp;lt;n&amp;gt; &amp;lt;e&amp;gt; : &amp;quot;✈&amp;quot;   U2708&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-6&quot; title=&quot;6&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;z&amp;gt; &amp;lt;a&amp;gt; &amp;lt;p&amp;gt;         : &amp;quot;⚡&amp;quot;   U26A1&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-7&quot; title=&quot;7&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-8&quot; title=&quot;8&quot;&gt;# prefix &amp;#39;m&amp;#39; = mathematical symbols&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-9&quot; title=&quot;9&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;m&amp;gt; &amp;lt;d&amp;gt; : &amp;quot;Δ&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-10&quot; title=&quot;10&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;m&amp;gt; &amp;lt;e&amp;gt; : &amp;quot;ϵ&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-11&quot; title=&quot;11&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;m&amp;gt; &amp;lt;l&amp;gt; : &amp;quot;λ&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-12&quot; title=&quot;12&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-13&quot; title=&quot;13&quot;&gt;# misc&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-14&quot; title=&quot;14&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;colon&amp;gt; &amp;lt;bar&amp;gt; &amp;lt;bar&amp;gt; : &amp;quot;ಠ_ಠ&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb5-15&quot; title=&quot;15&quot;&gt;&amp;lt;Multi_key&amp;gt; &amp;lt;less&amp;gt; &amp;lt;3&amp;gt; : &amp;quot;❤&amp;quot;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;youre-out-of-your-element-capslock&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;You’re out of your element, CapsLock &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#youre-out-of-your-element-capslock&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;CapsLock sucks and everyone hates it.&lt;/p&gt;
&lt;p&gt;People &lt;em&gt;think&lt;/em&gt; they use CapsLock, but, &lt;em&gt;I&lt;/em&gt; think, if people were honest with themselves they would admit that CapsLock is the worse than useless: it’s usually counter-productive. Also, if you find yourself frequently needing to type in ALL CAPS, maybe you should look at life: &lt;em&gt;what have you become&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;I like to remap my CapsLock key to a modifier key I use more frequently: Ctrl.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb6&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-1&quot; title=&quot;1&quot;&gt;setxkbmap \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-2&quot; title=&quot;2&quot;&gt;  -model pc105 \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-3&quot; title=&quot;3&quot;&gt;  -layout us \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-4&quot; title=&quot;4&quot;&gt;  -variant altgr-intl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-5&quot; title=&quot;5&quot;&gt;  -option compose:rctrl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb6-6&quot; title=&quot;6&quot;&gt;  -option ctrl:nocaps&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;xcape&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;XCape &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#xcape&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The other function of my CapsLock key only happens when it is pressed without any additonal keys. Basically, if I hit &lt;code&gt;CapsLock+[t]&lt;/code&gt;, I want a new tab, but if I just hit &lt;code&gt;CapsLock&lt;/code&gt;, it doesn’t do anything—which &lt;em&gt;was&lt;/em&gt; a waste.&lt;/p&gt;
&lt;p&gt;The program &lt;a href=&quot;https://github.com/alols/xcape&quot;&gt;XCape&lt;/a&gt; allows you to configure modifier keys (Alt, Ctrl, Shift, Meta) to act as other keys when pressed on their own. And, since the CapsLock key is so central on my keyboard, I also use it as an escape key. Compiling &lt;code&gt;xcape&lt;/code&gt; is pretty straight forward (provided you have the requisite build tools):&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb7&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;git&lt;/span&gt; clone https://github.com/alols/xcape.git .&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb7-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;bu&quot;&gt;cd&lt;/span&gt; xcape &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;make&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The command that allows for that functionality is also pretty straight-forward:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb8&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb8-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;xcape&lt;/span&gt; -e &lt;span class=&quot;st&quot;&gt;&amp;#39;Control_L=Escape&amp;#39;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, I also use the option that allows &lt;code&gt;[Ctrl]+[Alt]+[Backspace]&lt;/code&gt; to end an &lt;code&gt;X&lt;/code&gt; session. So my final &lt;code&gt;setxkbmap&lt;/code&gt; looks like:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb9&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;ex&quot;&gt;setxkbmap&lt;/span&gt; \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-2&quot; title=&quot;2&quot;&gt;  -model pc105 \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-3&quot; title=&quot;3&quot;&gt;  -layout us \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-4&quot; title=&quot;4&quot;&gt;  -variant altgr-intl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-5&quot; title=&quot;5&quot;&gt;  -option compose:rctrl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-6&quot; title=&quot;6&quot;&gt;  -option ctrl:nocaps \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb9-7&quot; title=&quot;7&quot;&gt;  -option terminate:ctrl_alt_bksp&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;key-autorepeat&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Key Autorepeat &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#key-autorepeat&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are some keyboard options that cannot be set via &lt;code&gt;setxkbmap&lt;/code&gt;. The &lt;code&gt;AutoRepeat&lt;/code&gt; option was removed from the &lt;code&gt;X&lt;/code&gt; keyboard driver (&lt;code&gt;kbd(4)&lt;/code&gt;) as of &lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=601853&quot;&gt;version 1.4.0&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The only recourse is using &lt;code&gt;xset(1)&lt;/code&gt;, the &lt;code&gt;X&lt;/code&gt; user-preference utility. An infinitely customizable keyrate is one of the many luxuries of using a Linux keyboard.&lt;/p&gt;
&lt;p&gt;There are two main options that matter for me in &lt;code&gt;xset&lt;/code&gt; that affect the autorepeat rate: AutoRepeatDelay and AutoRepeatRate&lt;/p&gt;
&lt;p&gt;The syntax for &lt;code&gt;xset&lt;/code&gt; autorepeat is:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb10&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb10-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; [-r keycode] rate [AutoRepeatRate] [AutoRepeatDelay]&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By omitting the &lt;code&gt;-r keycode&lt;/code&gt; you apply the &lt;code&gt;rate&lt;/code&gt; to all keys (e.g., &lt;code&gt;xset -r 10&lt;/code&gt; will apply the &lt;code&gt;rate&lt;/code&gt; settings only to the “1” key). The default AutoRepeatDelay is 660ms and the default AutoRepeatRate is 25Hz, which is fine, but after tweaking this rate and living with it for a few days it will seem &lt;em&gt;unbearably slow&lt;/em&gt;. My settings are:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb11&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb11-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; r rate 330 75&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These settings half the time I spend waiting for a key to auto-repeat, and triple the rate at which that auto-repeat fires.&lt;/p&gt;
&lt;p&gt;While mentioning &lt;code&gt;xset&lt;/code&gt; it’s also worth mentioning that I hate HATE the system beep. It’s that beep that happens when you double-tab Tab in Bash, or try to backspace beyond the beginning of a line (which happens a lot with a fast AutoRepeatRate). You can probably disable it many ways in &lt;code&gt;X&lt;/code&gt;, but I use:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb12&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb12-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; -b&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/section&gt;
&lt;section id=&quot;persistence&quot; class=&quot;level2&quot;&gt;
&lt;h2&gt;Persistence &lt;a href=&quot;https://tylercipriani.com/tags/keyboard/#persistence&quot;&gt;¶&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By placing the &lt;code&gt;setxkbmap&lt;/code&gt; command, the &lt;code&gt;xcape&lt;/code&gt; command, and the two &lt;code&gt;xset&lt;/code&gt; commands shown above into &lt;code&gt;~/.xinitrc&lt;/code&gt;, that configuration will load whenever &lt;code&gt;X&lt;/code&gt; is started.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb13&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;#!/usr/bin/env bash&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;co&quot;&gt;# ~/.xinitrc&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;co&quot;&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-5&quot; title=&quot;5&quot;&gt;&lt;span class=&quot;ex&quot;&gt;has?&lt;/span&gt;() &lt;span class=&quot;kw&quot;&gt;{&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-6&quot; title=&quot;6&quot;&gt;    &lt;span class=&quot;bu&quot;&gt;command&lt;/span&gt; -v &lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;va&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;op&quot;&gt;&amp;gt;&lt;/span&gt; /dev/null &lt;span class=&quot;op&quot;&gt;2&amp;gt;&amp;amp;1&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-7&quot; title=&quot;7&quot;&gt;&lt;span class=&quot;kw&quot;&gt;}&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-8&quot; title=&quot;8&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-9&quot; title=&quot;9&quot;&gt;&lt;span class=&quot;co&quot;&gt;# Keyboard stuffs&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-10&quot; title=&quot;10&quot;&gt;&lt;span class=&quot;co&quot;&gt;# ---&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-11&quot; title=&quot;11&quot;&gt;&lt;span class=&quot;co&quot;&gt;# * use right-alt as Alt-Gr key ($ → £)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-12&quot; title=&quot;12&quot;&gt;&lt;span class=&quot;co&quot;&gt;# * use right ctrl key as compose (ctrl 1 2 → ½)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;co&quot;&gt;# * use ctrl+alt+bksp to restart `X`&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-14&quot; title=&quot;14&quot;&gt;&lt;span class=&quot;co&quot;&gt;# * Capslock → Ctrl&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-15&quot; title=&quot;15&quot;&gt;&lt;span class=&quot;co&quot;&gt;# * Alt-Gr + Space = nbsp/Alt-Gr + Shift + Space = shy nbsp&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-16&quot; title=&quot;16&quot;&gt;&lt;span class=&quot;ex&quot;&gt;setxkbmap&lt;/span&gt; \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-17&quot; title=&quot;17&quot;&gt;  -layout us \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-18&quot; title=&quot;18&quot;&gt;  -variant altgr-intl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-19&quot; title=&quot;19&quot;&gt;  -option compose:rctrl \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-20&quot; title=&quot;20&quot;&gt;  -option terminate:ctrl_alt_bksp \&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-21&quot; title=&quot;21&quot;&gt;  -option ctrl:nocaps&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-22&quot; title=&quot;22&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-23&quot; title=&quot;23&quot;&gt;&lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; -b            &lt;span class=&quot;co&quot;&gt;# Stop beeping at me (A.K.A turn off PC speaker)&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-24&quot; title=&quot;24&quot;&gt;&lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; r rate 330 60 &lt;span class=&quot;co&quot;&gt;# Set keyboard repeat rate&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-25&quot; title=&quot;25&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb13-26&quot; title=&quot;26&quot;&gt;&lt;span class=&quot;ex&quot;&gt;has?&lt;/span&gt; xcape &lt;span class=&quot;kw&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;ex&quot;&gt;xcape&lt;/span&gt; -e &lt;span class=&quot;st&quot;&gt;&amp;#39;Control_L=Escape&amp;#39;&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;# https://github.com/alols/xcape&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;~/.xinitrc&lt;/code&gt; will NOT, however, keep those configurations when an external USB keyboard is added to the mix.&lt;/p&gt;
&lt;p&gt;The configuration loaded by &lt;code&gt;setxkbmap&lt;/code&gt; can easily become persistent since it is part of the &lt;code&gt;X&lt;/code&gt; keyboard driver. I have the following in a file at &lt;code&gt;/etc/X11/xorg.conf.d/10-keyboard.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb14&quot;&gt;&lt;pre class=&quot;sourceCode numberSource numberLines&quot;&gt;&lt;code class=&quot;sourceCode&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-1&quot; title=&quot;1&quot;&gt;Section &amp;quot;InputDevice&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-2&quot; title=&quot;2&quot;&gt;  Identifier &amp;quot;Muh Keyboard&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-3&quot; title=&quot;3&quot;&gt;  MatchIsKeyboard &amp;quot;true&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-4&quot; title=&quot;4&quot;&gt;  Option &amp;quot;xkblayout&amp;quot; &amp;quot;us&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-5&quot; title=&quot;5&quot;&gt;  Option &amp;quot;xkbvariant&amp;quot; &amp;quot;altgr-intl&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-6&quot; title=&quot;6&quot;&gt;  Option &amp;quot;Xkboptions&amp;quot; &amp;quot;compose:rctrl&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-7&quot; title=&quot;7&quot;&gt;  Option &amp;quot;Xkboptions&amp;quot; &amp;quot;terminate:ctrl_alt_bksp&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-8&quot; title=&quot;8&quot;&gt;  Option &amp;quot;Xkboptions&amp;quot; &amp;quot;ctrl:nocaps&amp;quot;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb14-9&quot; title=&quot;9&quot;&gt;EndSection&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;xset&lt;/code&gt; commands and &lt;code&gt;xcape&lt;/code&gt; daemon are a bit more difficult to persist when attaching external keyboards.&lt;/p&gt;
&lt;p&gt;In the lazy past, I created a file in my &lt;code&gt;~/bin/&lt;/code&gt; directory (which, in my case, is on my &lt;code&gt;$PATH&lt;/code&gt;) that I ran manually whenever a new keyboard was attached.&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb15&quot;&gt;&lt;pre class=&quot;sourceCode numberSource bash numberLines&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;co&quot;&gt;#!/usr/bin/env bash&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-2&quot; title=&quot;2&quot;&gt;&lt;span class=&quot;co&quot;&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-3&quot; title=&quot;3&quot;&gt;&lt;span class=&quot;co&quot;&gt;# ~/bin/keyboard—In case of new keyboard, break gla...er...I mean...run this.&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-4&quot; title=&quot;4&quot;&gt;&lt;span class=&quot;co&quot;&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-5&quot; title=&quot;5&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-6&quot; title=&quot;6&quot;&gt;&lt;span class=&quot;kw&quot;&gt;(&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-7&quot; title=&quot;7&quot;&gt;  &lt;span class=&quot;fu&quot;&gt;sleep&lt;/span&gt; 1&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-8&quot; title=&quot;8&quot;&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-9&quot; title=&quot;9&quot;&gt;  &lt;span class=&quot;va&quot;&gt;DISPLAY=&lt;/span&gt;:0.0 &lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; -b&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-10&quot; title=&quot;10&quot;&gt;  &lt;span class=&quot;va&quot;&gt;DISPLAY=&lt;/span&gt;:0.0 &lt;span class=&quot;fu&quot;&gt;xset&lt;/span&gt; r rate 330 60&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-11&quot; title=&quot;11&quot;&gt;  &lt;span class=&quot;ex&quot;&gt;xcape&lt;/span&gt; -e &lt;span class=&quot;st&quot;&gt;&amp;#39;Control_L=Escape&amp;#39;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-12&quot; title=&quot;12&quot;&gt;  &lt;span class=&quot;va&quot;&gt;DISPLAY=&lt;/span&gt;:0.0 &lt;span class=&quot;ex&quot;&gt;notify-send&lt;/span&gt; &lt;span class=&quot;st&quot;&gt;&amp;quot;External USB Connected&amp;quot;&lt;/span&gt;&lt;/a&gt;
&lt;a class=&quot;sourceLine&quot; id=&quot;cb15-13&quot; title=&quot;13&quot;&gt;&lt;span class=&quot;kw&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;&amp;amp;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Getting over to my terminal and typing: &lt;code&gt;keyboard&lt;/code&gt; everytime I attached a new keyboard is pretty far from &lt;em&gt;perfect&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;So what are my other options? Initially, I thought about doing something with &lt;code&gt;acpid(8)&lt;/code&gt; (&lt;a href=&quot;https://github.com/thcipriani/acpi&quot;&gt;since I use that a ton&lt;/a&gt;), which would have been easy enough. &lt;code&gt;acpid&lt;/code&gt; notifies user-space utilities about system events, which includes when devices are attached.&lt;/p&gt;
&lt;p&gt;After reading a great post from &lt;a href=&quot;http://pbrisbin.com/posts/disable_all_the_caps/&quot;&gt;Pat Brisbin&lt;/a&gt; about udev events, I thought (and think) that’s the answer. You can probably tell that my &lt;code&gt;~/bin/keyboard&lt;/code&gt; script has evolved to accommodate what he outlined in his article. In any event (pun intended), I created a file at &lt;code&gt;/etc/udev/rules.d/99-usb-keyboards.rules&lt;/code&gt; with the following contents:&lt;/p&gt;
&lt;div class=&quot;sourceCode&quot; id=&quot;cb16&quot;&gt;&lt;pre class=&quot;sourceCode bash&quot;&gt;&lt;code class=&quot;sourceCode bash&quot;&gt;&lt;a class=&quot;sourceLine&quot; id=&quot;cb16-1&quot; title=&quot;1&quot;&gt;&lt;span class=&quot;va&quot;&gt;SUBSYSTEM=&lt;/span&gt;=&lt;span class=&quot;st&quot;&gt;&amp;quot;input&amp;quot;&lt;/span&gt;, &lt;span class=&quot;va&quot;&gt;ACTION=&lt;/span&gt;=&lt;span class=&quot;st&quot;&gt;&amp;quot;add&amp;quot;&lt;/span&gt;, &lt;span class=&quot;va&quot;&gt;RUN+=&lt;/span&gt;&lt;span class=&quot;st&quot;&gt;&amp;quot;/bin/su tyler --shell=/bin/bash -c /home/tyler/bin/keyboard&amp;quot;&lt;/span&gt;&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Which seems to do the trick!&lt;/p&gt;
&lt;p&gt;The configuration you see above is the result of &lt;em&gt;way too much&lt;/em&gt; thinking about how I use my keyboard. Now, I just need to get this configuration to work &lt;em&gt;without&lt;/em&gt; &lt;code&gt;X&lt;/code&gt; Server…&lt;em&gt;le sigh&lt;/em&gt;&lt;/p&gt;
&lt;/section&gt;
</description>


	<comments>//tylercipriani.com/blog/2015/01/23/toward-a-useful-keyboard-in-x/#comments</comments>

</item>
<item>
	<title>Alt-Numpad for Linux</title>

	<guid isPermaLink="false">https://tylercipriani.com/blog/2012/07/26/alt-numpad-for-linux/</guid>

	<link>https://tylercipriani.com/blog/2012/07/26/alt-numpad-for-linux/</link>

	<dc:creator>Tyler Cipriani</dc:creator>



	<category>computing</category>

	<category>keyboard</category>

	<category>unicode</category>


	<pubDate>Tue, 26 Jul 2011 00:00:00 +0000</pubDate>
	<dcterms:modified>2017-07-01T00:49:09Z</dcterms:modified>


	<description>&lt;p&gt;In Ubuntu the alt+numpad ACSII codes don’t work—this &lt;em&gt;was&lt;/em&gt; a major stumbling block for me since I am annoyingly &lt;a href=&quot;http://www.smashingmagazine.com/2011/08/15/mind-your-en-and-em-dashes-typographic-etiquette/&quot; title=&quot;Smashing Magazine—mind your em and en dashes&quot;&gt;picky about typography&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After spending way too much time Googling I found that these steps work:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hold &lt;code&gt;Ctrl+Shift+U&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Release the “U” key (while still holding Ctrl+Shift)&lt;/li&gt;
&lt;li&gt;Type the Unicode code for the special character you’d like to use&lt;/li&gt;
&lt;li&gt;Find unicode characters by &lt;a href=&quot;http://www.wolframalpha.com/input/?i=em+dash&quot; title=&quot;em dash - Wolfram|Alpha&quot;&gt;searching on Wolfram Alpha&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Another great unicode character reference for math and science can be found at &lt;a href=&quot;http://tlt.its.psu.edu/suggestions/international/bylanguage/mathchart.html&quot; title=&quot;Math Unicode Entities&quot;&gt;Penn State’s website&lt;/a&gt;. Of course, if you don’t want to remember these unicode characters, CopyPasteCharacter.com is a good &lt;a href=&quot;http://copypastecharacter.com/&quot; title=&quot;✿ Our favorite set — CopyPasteCharacter.com&quot;&gt;ACSII character resource&lt;/a&gt;.&lt;/p&gt;
</description>


	<comments>//tylercipriani.com/blog/2012/07/26/alt-numpad-for-linux/#comments</comments>

</item>

</channel>
</rss>
