4 minutes
Written: 2024-03-08 01:35 +0000
Updated: 2024-08-06 00:52 +0000
Icelandic with Compose Keys on Linux
This post is part of the Colemak necessities and Keboard management series.
Minimally expanding my existing layouts for supporting Icelandic orthography.1
Background
Life outside Emacs can be daunting for a lot of reasons, the lack of auctex
and org-latex
being a major one. Additionally, for the purposes of my
(somewhat current) country of residence2, it is often useful to
be able to type Icelandic characters without resorting to something like typeit.
Compositional Choices
I already use klfc
to generate a very portable (in a Unix sense) customized
VIM based Colemak binding layout. Some reasons why I first decided to modify the
compose keybindings instead of extending that are3:
- The keys and bindings defined here aren’t in use enough for me to justify actually adding them to one of my levels.
- It is slightly easier to share
.XCompose
files compared to theklfc
compatiblejson
files. - It also integrates nicely with my dotfiles and templates
- There are a few tools for concatenating fragments4 but it seemed more
straightforward to use my existing
chezmoi
machinery- The tools, especially ext-compose, can be used as a pretty definitve source of viable mappings
- There are a few tools for concatenating fragments4 but it seemed more
straightforward to use my existing
However, though the compose key and chords works great for TeX it isn’t exactly
ideal for language bindings, so I ended up with a hybrid, where some keys are
placed on the dead-greek (AltGr
) level and the rest are via multi-key (a.k.a
compose
) chords.
Setting the Compose Key
Modern keyboards don’t often come with a dedicated compose
key. For
simplicity I opted to choose one of the default supported rules for the this:
1grep "compose:" /usr/share/X11/xkb/rules/base.lst
2 compose:ralt Right Alt
3 compose:lwin Left Win
4 compose:lwin-altgr 3rd level of Left Win
5 compose:rwin Right Win
6 compose:rwin-altgr 3rd level of Right Win
7 compose:menu Menu
8 compose:menu-altgr 3rd level of Menu
9 compose:lctrl Left Ctrl
10 compose:lctrl-altgr 3rd level of Left Ctrl
11 compose:rctrl Right Ctrl
12 compose:rctrl-altgr 3rd level of Right Ctrl
13 compose:caps Caps Lock
14 compose:caps-altgr 3rd level of Caps Lock
15 compose:102 The "< >" key
16 compose:102-altgr 3rd level of the "< >" key
17 compose:paus Pause
18 compose:ins Insert
19 compose:prsc PrtSc
20 compose:sclk Scroll Lock
I went with compose:ralt
since compose:lalt
isn’t thing. Setting this in
sway
is simple and stacks well with the other settings:
1# To test
2swaymsg 'input * xkb_options compose:ralt'
To set this permanently:
1input * {
2 xkb_options "compose:ralt"
3}
Mapping Icelandic
I used TypeIt as a reference, since I’m rather used to it. The mapping therefore proceeds in two stages, an AltGr layer, and some compose keychords.
AltGr Layer
For the base keys, I did end up first extending the AltGr layer, with the following, as depicted in Fig. fig:altgrlayeris 5:
Which is defined in another json
file:
1{
2 "filter": "no tmk",
3 "singletonKeys": [
4 [ "Alt_L", "AltGr" ]
5 ],
6 "shiftlevels": [ "AltGr", "Shift+AltGr" ],
7 "keys": [
8 { "pos": "A", "letters": [ "á", "Á" ] },
9 { "pos": "F", "letters": [ "þ", "Þ" ] },
10 { "pos": "G", "letters": [ "ð", "Ð" ] },
11 { "pos": "K", "letters": [ "é", "É" ] },
12 { "pos": "L", "letters": [ "í", "Í" ] },
13 { "pos": ";", "letters": [ "ó", "Ó" ] },
14 { "pos": "I", "letters": [ "ú", "Ú" ] },
15 { "pos": "O", "letters": [ "ý", "Ý" ] }
16 ]
17}
Installation is similar to the previous post:
1git clone https://github.com/39aldo39/klfc
2cd klfc
3# Kanged from the AUR https://aur.archlinux.org/packages/klfc/
4cabal v1-update
5cabal v1-install --only-dependencies --ghc-options=-dynamic --force-reinstalls
6cabal v1-configure --prefix=/usr --ghc-options=-dynamic
7cabal v1-build
8# Build layout
9./dist/build/klfc/klfc ~/.config/klfc/colemak.json ~/.config/klfc/extendVIM.json ~/.config/klfc/is_altgr_Colevim.json -o colevimIS
10# Install
11cd colevimIS/xkb/
12./install-system.sh && ./scripts/install-xcompose.sh
Compose Keychords
It turns out there are really only two left:
1# ~/.XCompose
2<Multi_key> <a> <e> : "æ"
3<Multi_key> <o> <i> : "ö"
Conclusions
This is going to take a while to get used to for sure, but eventually it should help me reduce the time it takes me to get thoughts on (digital) paper in Icelandic. I will probably need to touch type on something like fastfingers 6.
I had hoped to include a bunch of unicode math and other compose keychords, but
it is annoying to have to keep track of the translations like *
to asterisk
and similar7.
Recall that the compose key is essentially for keychords, like a dead key on steriods. ↩︎
Where the phrasing is mostly for legal purposes, as anyone dealing with immigration and taxation would know. ↩︎
I ended up extending the layout a bit for the Icelandic mappings though. ↩︎
Like xcompose, or ext-compose, or xcomposer, or xcomposegen, or even something with a GUI like Composition. ↩︎
As in the previous post the images are made with keyboard-layout-editor. ↩︎
Typingclub or typing.com or keybr are favorites but don’t support Icelandic yet. ↩︎
Perhaps I too will try my hand at a cleaner
xcompose
generator. ↩︎
Series info
Colemak necessities series
- Switching to Colemak
- Refactoring Dotfiles For Colemak
- Remapping Keys with XKB and KLFC
- Remapping Keys for ColemakVIM on MacOS
- Icelandic with Compose Keys on Linux <-- You are here!
Series info
Keboard management series
- Remapping Keys with XKB and KLFC
- Remapping Keys for ColemakVIM on MacOS
- Icelandic with Compose Keys on Linux <-- You are here!