This is an old revision of the document!
Table of Contents
Aim
- Swap (left) control and caps lock
- Swap “ and @
Rationale
Caps lock and control
" and @
If you're British and work outside the UK but in a partly English-speaking environment, there's a good chance you'll end up splitting your time between British and American keyboards. The most noticeable annoyance involved is that the British keyboard reverses ” and @ (although not on most Macs, so if you split your time between PC and Macs in the UK you may have the same problem). If you're able to touchtype all symbols then you may prefer just to use a US keymap everywhere. If you're not, you will probably want a British-ish keymap for use on British keyboards, so that you can find symbols like \ | # ~ ` ¬ that differ between the maps. You probably don't want to use a British keymap on a US keyboard, because it doesn't have enough keys so you will lose access to symbols that are important, at the least, to programmers.
One solution is to use an alternative British keymap that reverses “ and @ on British keyboards and a standard US layout on American ones. Some symbols will be in different places, but the location of these keys varies between physical keyboards anyhow, and they will at least be labelled correctly. A side-benefit is that most people prefer the US location of ” on the home row.
X (may be KDE only)
Switching " and @
Keyboard maps in X are configured in /etc/X11/xkb. Each locale has a single file in /etc/X11/xkb/symbols which contains details of all variants for that locale (often an international version with deadkeys and a dvorak variant). They're defined relative to some other layout (ie “start with the standard US keyboard then make the following changes…”).
Here is a version of the gb layout that includes a “hybrid” variant that swaps “ and @ back to their US positions (to overwrite /etc/X11/xkb/rules/gb – the extension needs to be deleted first). Then various config files need to be updated in order to be able to select this variant through the standard KDE system settings. These need to be overwritten in /etc/X11/xkb/rules:
Caps lock and control (KDE)
System settings → Region and language → Keyboard layout → Advanced → Ctrl key position → Swap control and caps lock
Caps lock and control (XFCE)
Putting the following in ~/.config/autostart/caps-lock-ctrl-swap.desktop seems to work most of the time:
- caps-lock-ctrl-swap.desktop
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=setxkbmap Exec=/usr/bin/setxkbmap -option "ctrl:swapcaps" Hidden=false
Sundry changes
- Add Latin American keymap
- Key(s) to change layout → Scroll lock
- Compose key position → Left win
Console
Replace the standard UK keymap with one modified to swap control, caps lock, " and @. Keymaps are located in /usr/share/kbd/keymaps/i386/qwerty/. The UK map is called uk.map and can be gzipped (adding .gz) or not. If you want one change but not the other, then you ought to be able to figure out what to do by diffing the above file with the standard uk.map.