Getting Norwegian characters on a US keyboard in Linux
About a year ago, I switched to Linux from MacOS. After some tinkering, I got everything set up nicely for coding, and writing. Most of my writing is in Norwegian, and I had a .Xmodmap hack to get Norwegian characters like I was used to from MacOS.
This year, I decided to a fresh install after a year of finding out how I liked my setup, and decided to change the keybindings a bit. Previously, I used Alt_L as a modifier to access the Norwegian characters, but I like using that modifier for shifting through tabs in my editor and Firefox, so I’ve decided to use the right alt-key, ISO_Level3_Shift or AltGr for accessing the Norwegian characters.
In MacOS the default bindings are:
| Keys | Result |
|---|---|
| Option ‘ | æ |
| Option o | ø |
| Option a | å |
| Shift Option ‘ | Æ |
| Shift Option o | Ø |
| Shift Option a | Å |
So I created the following Xmodmap settings and saved to ~/.Xmodmap:
keysym apostrophe = apostrophe quotedbl apostrophe quotedbl ae AE
keysym o = o O o O oslash Oslash
keysym a = a A a A aring Aring
Each keysym column in the table corresponds to a particular combination of modifier keys:
- Key
- Shift+Key
- Mode_switch+Key
- Mode_switch+Shift+Key
- ISO_Level3_Shift+Key
- ISO_Level3_Shift+Shift+Key
For more details of Xmodmap, check out the Arch wiki on xmodmap.