I am a Unicode fetishist. As such, I have been bothered for a long time for not being able to type some of the symbols I use quite frequently:
U+2026, is probably one of the most underused symbols in existence. Yes, I know it is easy to just type three dots, but at least those of you that know of the semantic web should understand that it is useful to use the proper symbol here. Unfortunately, it looks bad in monospace fonts, so one could consider not using it there. But then, aren’t monospace fonts only meant for technical text, which by its nature shouldn’t contain ellipses?
U+2014, are indispensable if you appreciate nice typography. It is awful to see how the normal hyphen is abused. Em dash is not used often in Dutch, but it is recommended by some style guides in English, although in most situations I like an en dash anyway. See the Wikipedia article on dashes.
All of these can be found in the General Punctuation code chart.
Doing a web search on modifying your keyboard under Linux will certainly lead you to xmodmap. There are quite some descriptions of it around. The trouble is that it is complex and bothersome. So you want some tool to set this up for you. Both KDE and GNOME offer you possibilities to change some keys, but do not offer you full control.
Luckily, there is XKeyCaps. It is rather old, unfortunately development is no longer active and the interface is not ideal, but it does exactly what I need: you can modify each key individually, with any possible symbol. And best of all: it can write out an xmodmap file which you can use to load those settings automatically.
First off, you’ll probably have to install XKeyCaps. Xmodmap is installed on all Linuxes.
xkeycaps. You’ll get something like this:
With the right mouse button on a key, you can choose
Choose a KeySym you want, click on it and
choose the symbol you want it to output. You can use the key like
that immediately. Most probably, you’ll want to use one of the
higher KeySyms, like 5 or 6, since they won’t interfere too much
with what you’re used to. For example, I edited key 0x3D (/ on a US
qwerty) for the KeySym 6 to be
ellipsis. The symbols from
above can all be found under the Character Set
Of course, you don’t want to do this every time you start your computer, so you want to make those changes last. The way to go is to let XKeyCaps write out an xmodmap file, which you let xmodmap read in at each startup.
Once you’ve edited your keys to your satisfaction, choose the button
Write Output in XKeyCaps and confirm (it doesn’t matter
whether you choose
Changed Keys or
All Keys). It will
tell you it wrote a file
to your home directory. Now I am rather unsatisfied with this file,
since it contains way too much. We want to keep things under
Delete the file .Xmodmap , which is a symbolic link XKeyCaps produced, open your favorite text editor, create the file .Xmodmap and copy those lines over which you are interested in from the file XKeyCaps created. You will have to remember which keys you edited, but the names are pretty good mnemonics, so that shouldn’t be too hard.
Open the file .profile in your home directory and add the following lines to it:
# Tell xmodmap to read in my own xmodmap file at startup xmodmap .Xmodmap
Then, remove the file .Xmodmap-localhost which XKeyCaps produced for you. Otherwise, xmodmap will ask you for confirmation every time.
Some desktop environments (Gnome) provide a mechanism which will read in the .Xmodmap file automatically for you at startup. The functionality was buggy for a while, but since openSUSE 11.2, it seems to work.
You can test your current
file at any moment by opening a shell and typing
in your home directory. You’ll then immediately be able to test your
changes, even on the command line (provided your console font has
the relevant symbols.)
I added the symbols discussed above as follows:
Here is my current .Xmodmap :
keycode 0x0E = 5 percent 5 percent EuroSign endash keycode 0x10 = 7 ampersand 7 ampersand onehalf emdash keycode 0x3D = slash question slash question questiondown ellipsis
It’s a relic of the funny syntax of xmodmap that you have to repeat the first two each time. The third and fourth value are for rather peculiar keyboard setups. However, if someone knows better, please let me know.
The first is the normal key, the second with Shift , the fifth with AltGr and the sixth with AltGr+Shift .
Have fun experimenting.
Update: I used to have two lines for the curly double quote signs in here as well, but I found out they are already present on the us-international keyboard. They are reachable with AltGr+Shift+[ and AltGr+Shift+] . Well, on Linux, at least. See the XKeyCaps screenshot to know which keys I mean by that (22 and 23).
Another update: Some keyboards have one extra key next to the left Shift key. It usually contains <>|¦, so it is fully superfluous, and you can redefine it at will, e.g. with the following .Xmodmap :
keycode 0x30 = dead_acute dead_diaeresis dead_acute dead_diaeresis singlelowquotemark doublelowquotemark apostrophe quotedbl keycode 0x5E = endash emdash endash emdash ellipsis periodcentered
On most keyboards
is simply marked
Alt. In any case, it is the key to the right
of the space bar.