Brain Overflow

Easy Diacritics Configuration for Sway

One thing I feel MacOS does really well out of the box is support for typing diacritics. Those are the accent marks that languages like Polish or French, for example, make use of. It's impossible to just...omit them and remain coherent in the language, so if you type anything but English ever, you gotta have em (you can't even type the name of the French language without one! Français).

I wasn't sure how to go about getting something easy on Linux -- i.e., not having to type alt codes all the time or something similarly grueling. This was a problem that I thought would be further complicated by being a tiling window manager user, on Wayland no less (I use Sway), but it was quite simple.

This is all I had to do to my Sway config:

input "type:keyboard" {
-    xkb_options ctrl:nocaps
+    xkb_options ctrl:nocaps,compose:ins

Here, my Caps Lock key is configured to act as a Control key, and (the relevant part..) the 'Compose' key is set to the 'Insert' key on my keyboard. It's common to set it to the Alt key to the right of the spacebar, but I figured 'Insert' seems more intuitive, plus I literally never use it for anything else, so why not put it to work. I do actually use the right-hand Alt key to take some of the load off of my left thumb.

For reference, this is a list of possible alternate compose: options. As far as I can tell, you need to have xkb_options all on one line.