Accented characters using a US keyboard layout on OpenBSD

       139 words, 1 minutes

My refurbished ThinkPad T460s shipped with an International US layout keyboard. And with the default Xenocara configuration, I couldn’t type accents. As I write 90% of my real-life emails in French, this was an issue.

Well… until I read the OpenBSD manpages for setxkbmap(1) and xkeyboard-config(7). Then I added the following line to my ~/.xsession file:

setxkbmap -model pc105 -layout us -variant altgr-intl -option compose:rctrl

And I can now use the right Ctrl key as Compose and issue accented characters using the so called “dead-keys”.

Ctrl ' [aAeiou]  = áÁéíóú
Ctrl ` [aAeiou]  = àÀèìòù
Ctrl " [aAeiou]  = äÄëïöü
Ctrl ^ [aAeiou]  = âÂêîôû
Ctrl - [aAeiou]  = āĀēīōū
Ctrl ~ [aAeioun] = ãÃẽĩõũñ
Ctrl , [cC]      = çÇ

Note that Alt Gr can also be used by default. But the key positions are quite complicated to remember.