Keyboard layout: GB layout with dead keys on Linux, macOS, Windows
I'm using a UK keyboard layout with dead keys to access accents. The inspiration
is James Campbell's UK International keyboard, but I deviated a little bit, eg.:
AltGr+o
becomes œ, AltGr+a
is æ, this makes typing « mon cœur » and "UNIX©
dæmon" easier.
In xkeyboard-config's default layouts, the "English (UK)" layout puts the grave
on the #
hash sign and the circumflex on the @
key, which is a choice I
don't like. The "English (UK, intl., with dead keys)" layout puts the dead keys
on more sensible positions eg. grave on the `
key, but the dead keys are the
primary keys, without an AltGr
, which I find annoying. Hence making my own
layout, this is the final result.
1. Linux with X11
Install uk-intl.xkb somewhere in $HOME
. Arrange to run xkbcomp uk-intl.xkb
$DISPLAY
on session startup.
This includes a remapping of Caps Lock to be a second control.
2. Linux with Wayland
At some point, this stopped working when I moved to a desktop that uses Wayland
only, without X11. It appears that changes to input handling means xkbcomp
can't change the display's server layout, or something. Peter Hutterer wrote a
series of posts: User-specific XKB configuration, describing how to allow local
user configuration to augment the system's built-in layouts in the new world of
Wayland. libxkbcommon
's documentation has much the same information.
In essence, we're defining a new gb
variant that only has the changes from the
base layout. Extract xkb.tar.gz in $XDG_CONFIG_HOME
(so that the variant file
ends up as ~/.config/xkb/symbols/gb
). Log out / back in, then select the new
variant: under GNOME, go in the "Settings" tools, "Keyboard" page, in "Input
Sources" the little "+", "Add an Input Source" for "English (United Kingdom)",
and find "English (French accents on dead keys)".
While we're at it, C-.
starts IBus emoji typing, to disable that:
gsettings set org.freedesktop.ibus.panel.emoji hotkey "[]"
Under KDE, to activate the new keyboard, go to "System settings", "Input & Output", "Keyboard", "Layout": "Add…".
3. macOS
Download and install UK Intl mk7. This can be edited with Ukulele. I started
from the GB keyboard layout and added a small number of dead keys. As a result
there may be other key combos that are different from Linux' layout above, for
characters I don't use (or not often). The mark "mk7" is because any
modification requires a new name, and that's how many attempts it took me to be
happy. I remember issues with the `
key being confused with the \
key, but I
don't remember if that was fixed by changing the layout definition or changing
an option in macOS' menus.
See also Change the behavior of the modifier keys to make Caps Lock another Control.
I also have the following to avoid unfortunate keyboard shortcuts:
3.1. iTerm2
iTerm2 has a number of annoying shortcuts that conflict with standard key combos
from readline eg. C-w
to close a tab. The following will disable those. Each
option to the left of the =
sign is an entry from a menu, to the right is a
unicode char. U+200B is "zero-width space", something we can't hit by accident.
defaults write com.googlecode.iterm2 NSUserKeyEquivalents '{ "Split Horizontally with Current Profile"="\U200B"; "Split Vertically with Current Profile"="\U200B"; "Split Horizontally..."="\U200B"; "Split Vertically..."="\U200B"; "Close"="\U200B"; "Close Terminal Window"="\U200B"; "Close All Panes in Tab"="\U200B"; "Minimize"="\U200B"; "Reset"="\U200B"; }'
3.2. Outlook
The default Cmd+V
results in messed up fonts. Ideally it'd be replaced with
a "paste" command that keeps text only, but I couldn't find this in the menus,
so "match style" is the least worst option.
defaults write com.microsoft.Outlook NSUserKeyEquivalents '{ "Paste"="\U200B"; "Paste and Match Style"="@v"; }'
The @
prefix is Cmd, ^
would be Control, ~
for Option, $
for Shift.
4. Windows 10
Get ukint20s-FP.zip, which contains a binary file (a .msi
) that requires
administrative rights to install then a reboot. This works on Windows 10 at
least, and worked on the last version of Windows that $WORK
forced me to use
before that.
The source file is a .klc
text file, which can be edited with Microsoft
Keyboard Layout Creator and then compiled the .msi
which can be installed.
MKLC requires .Net Framework, which needs twiddling in the settings to install
and make available.
In order to remap Caps Lock to Ctrl, use ctrl2cap (this is a sysinternal tool by Microsoft; it requires admin access for installation, and a reboot after).