index.org 6.95 KB
Newer Older
1
#+TITLE: Mastering the keyboard
2
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../dark.css" />
3
#+DATE: <2016-02-04 Thu>
Pierre Neidhardt's avatar
Pierre Neidhardt committed
4 5 6 7

The following article deals with techniques to optimize comfort and speed using
a computer.

8
* Touch typing
Pierre Neidhardt's avatar
Pierre Neidhardt committed
9

Pierre Neidhardt's avatar
Pierre Neidhardt committed
10 11
Writing text holds a central part in our use of computers: e-mails, searching,
web browsing, programming, configuring, etc.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
12 13

Touch typing is the art of typing (fast) without having to look at the keyboard.
14
This is a skill that is surprisingly left aside, even by professionals.  I
Pierre Neidhardt's avatar
Pierre Neidhardt committed
15 16
believe it to be a big time saver, while alleviating the frustration of too much
stuttering and too many typos.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
17

18 19
Touch typing can be trained in a fairly short amount of time.  One way would be
to use a trainer program such as [[https://www.gnu.org/software/gtypist/][GNU Typist]].  It is straightforward to go
Pierre Neidhardt's avatar
Pierre Neidhardt committed
20 21
through the various lessons and the result will be immediately noticeable.

22
Touch typing is highly dependent on the keyboard layout (a.k.a. /keymap/), so
23
you might want to choose the keymap wisely before starting the training.  Read on
24
for tips on keymaps.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
25

26
* Mouse-less control
Pierre Neidhardt's avatar
Pierre Neidhardt committed
27 28

The mouse use has increased tremendously since the rise of graphical user
29
interfaces.  Mostly for illegitimate reasons.  Do we really need a mouse to select
Pierre Neidhardt's avatar
Pierre Neidhardt committed
30 31
objects or to toggle buttons?

32 33 34 35
The mouse proves to be poor at selecting text.  How many times have you tried to
select a sentence and missed the last letter?  It is equally bad at selecting
objects.  When it comes to interact with the user interface, it is usually faster
to use keyboard shortcuts.  Well, we call them "shortcuts" for a reason…
Pierre Neidhardt's avatar
Pierre Neidhardt committed
36 37 38 39

The use of a mouse makes sense when there is a need for a continuous input, such
as in graphics design, video games, etc.

40
* Home row vs. arrows
Pierre Neidhardt's avatar
Pierre Neidhardt committed
41

42
The /home row/ refers to the center row of the alphabetical part of the
43
keyboard, that is, the characters =asdf…jkl;= on a QWERTY keyboard.  The
44
standard position is when the index fingers rest on the characters =f= and =j=
45
on a QWERTY keyboard.  Those letters usually come with a bump to make them
46
distinguishable without looking.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
47 48

Moving hands from the home row to the arrows back and forth can be a small waste
49
of time that quickly stacks up.  The time required for the "context switch" of
Pierre Neidhardt's avatar
Pierre Neidhardt committed
50 51 52
the hand disturbs the flow.

Arrows tend to be omnipresent when it comes to "regular" text editing or
53
interface navigation.  Now there are various changes we can make to the
Pierre Neidhardt's avatar
Pierre Neidhardt committed
54
environment so that the navigation bindings stick around the home row.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
55 56

First of, you may consider switching your text editor for one that allows
57
navigation without arrows.  Famous examples include /Emacs/ and /Vim/.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
58 59

The window manager can have limited bindings to such an extent that it forces
60 61
the use of arrows or the mouse.  Decent window managers usually feature full
keyboard control.  Popular examples include /Awesome/ and /i3/.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
62

63
Web browsers have become more and more dominant in our use of computers.  The way
Pierre Neidhardt's avatar
Pierre Neidhardt committed
64
the World Wide Web was designed has put emphasis on the mouse, so that it is now
65 66
almost impossible to browse the web without a mouse.  Which might be a sign for
poor design from the ground up.  But let's not drift off too much.  It is still
Pierre Neidhardt's avatar
Pierre Neidhardt committed
67
possible to use a graphical web browser while making best use of the keyboard
68
thanks to the "hint" feature.  Many Webkit-based browsers offer this feature.  It
Pierre Neidhardt's avatar
Pierre Neidhardt committed
69
is also possible to edit any field using your favourite editor, which greatly
Pierre Neidhardt's avatar
Pierre Neidhardt committed
70 71 72
alleviates the need for a mouse and arrows.

If you have got the chance to witness a hardcore geek with proper touch typing
Pierre Neidhardt's avatar
Pierre Neidhardt committed
73 74
skills and a keyboard / home row centered environment, you will be amazed by how
many actions per minute that geek can perform!
Pierre Neidhardt's avatar
Pierre Neidhardt committed
75

76
* Caps-Lock switch
Pierre Neidhardt's avatar
Pierre Neidhardt committed
77

78
The Caps-Lock key is very accessible albeit little used.  On the other hand, the
79
use frequency of keys such as =Control= or =Escape= is much higher (in
Pierre Neidhardt's avatar
Pierre Neidhardt committed
80 81
particular when using the Emacs or Vim text editors).

82 83
Therefore it is very recommended to swap Caps-Lock with the key you use most.
There are several ways of doing this, read on for an example.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
84

Pierre Neidhardt's avatar
Pierre Neidhardt committed
85 86 87
This is one of the keymap tweaks that will save you most from wrecking your
hands with some carpal tunnel syndrome.

88
* International custom keymaps
Pierre Neidhardt's avatar
Pierre Neidhardt committed
89

Pierre Neidhardt's avatar
Pierre Neidhardt committed
90
Users of languages using a Latin-based alphabet should be familiar with the
91
existence of a variety of "standard" keymaps out there: QWERTY (US, UK…),
Pierre Neidhardt's avatar
Pierre Neidhardt committed
92
QWERTZ, AZERTY, to name a few.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
93 94

If you find yourself writing in more than one language, you will often find the
95
need to switch keymap so that you can write some special characters easily.  This
Pierre Neidhardt's avatar
Pierre Neidhardt committed
96
is a big mistake, as the context switch between the various layouts can be
Pierre Neidhardt's avatar
Pierre Neidhardt committed
97 98 99
extremely disturbing and require minutes if not hours each time before feeling
comfortable again.

100 101 102
Letters and punctuation often vary between keymaps.  (AZERTY and QWERTY are good
examples of this.)  While additional special characters are welcome, the
positional alteration of standard characters is not strictly necessary.  So what
Pierre Neidhardt's avatar
Pierre Neidhardt committed
103
if we would have a keymap that contains special characters for various languages
104
at the same time?  There is no such standard keymap, but it is possible to create
Pierre Neidhardt's avatar
Pierre Neidhardt committed
105
one yourself.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
106

Pierre Neidhardt's avatar
Pierre Neidhardt committed
107 108
Using one single custom keymap has the advantage of eliminating the context
switch disturbance while providing direct access to all the desired special
109
characters.  Besides, it is possible to base the new keymap on QWERTY US, which
Pierre Neidhardt's avatar
Pierre Neidhardt committed
110
has some inherent benefits:
Pierre Neidhardt's avatar
Pierre Neidhardt committed
111

112
- Matching parentheses are next to each other.  Punctuation tends to be
113
  reasonably accessible (e.g. =,= and =.= are unshifted).
Pierre Neidhardt's avatar
Pierre Neidhardt committed
114 115

- It is the most widespread keymap, so when somebody wants to use your computer,
116
  chances are high they can type something.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
117 118

- Most importantly, some programs are ergonomically optimized for QWERTY US,
119
  such as Emacs and Vim.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
120 121

Bonus for scientists: it is possible to add some common mathematical characters,
122
such as =≠= or =⋅=, which can be a big time saver when it comes to writing
Pierre Neidhardt's avatar
Pierre Neidhardt committed
123 124
scientific documents.

125
** Custom Xkb keymaps
Pierre Neidhardt's avatar
Pierre Neidhardt committed
126

Pierre Neidhardt's avatar
Pierre Neidhardt committed
127 128
Let's move on to the details on how to load a custom layout for the X window
system without needing administrative rights.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
129

130 131
In the following, we will use the =xkb= folder as our workspace.  This folder is
arbitrary.  Replace the keymap name =custom= with any unused name you like.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
132

133
Create an =xkb/custom.xkb= file:
Pierre Neidhardt's avatar
Pierre Neidhardt committed
134

135
#+BEGIN_EXAMPLE
136 137 138 139 140 141 142 143 144
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete" };
    xkb_compat    { include "complete" };
    xkb_symbols   { include "pc+custom+inet(evdev)" };

    // Geometry is completely optional.
    // xkb_geometry  { include "pc(pc104)"  };
};
145
#+END_EXAMPLE
Pierre Neidhardt's avatar
Pierre Neidhardt committed
146

147
Fill in =xkb/symbols/custom=.  This file is formatted just like every other Xkb
148 149
symbol files, usually located in =X11/xkb/symbols/= under =/usr/share= or
=/usr/local/share=.
Pierre Neidhardt's avatar
Pierre Neidhardt committed
150 151 152

Finally, load the new keymap with

153 154 155
#+BEGIN_SRC sh
$ xkbcomp -I"xkb" "xkb/custom.xkb" $DISPLAY
#+END_SRC
Pierre Neidhardt's avatar
Pierre Neidhardt committed
156

157 158 159
For a concrete example, see [[https://gitlab.com/ambrevar/dotfiles/tree/master/.xkb/][my personal keymap]].  It is a superset of QWERTY US
which covers almost every language in western Europe, with Caps-Lock and Control
swapped.