For some time I’ve been wanting to change the default behavior of my keyboard (on an Ubuntu 18.04 machine) when using the composition keys (dead-keys).
The default behavior for the double quote key ("
) to be a compose key, in order to be able to input charaters like ä
("+a
)and ö
("+o
), so if I wanted a "
, I would need to press "+spacebar
. I was used to just double tap the "
key and get the "
(from the Windows days, I think), so I wanted that, but the default is the daeresis sign (¨
).
Don’t know if it’s the setup I have (a default american english keyboard with a PT-BR locale)
So my input source is: “English (US, intl., with dead keys)”
And formats are defined as: “Brasil”
After several searches and a few dead ends (ibus and ibus-tables), I finally ended up with a solution, for my use case anyway. It turns out that the compose sequences were controlled by the files in
/usr/share/X11/locale
And the file I needed to change was this one:
/usr/share/X11/locale/pt_BR.UTF-8/Compose
The files are quote self explanatory and they seem to function in a hierarchical way, with the more specialized layouts including the more generic ones and overriding where needed. The pt_BR file included the en_US one, and the values I needed overriding were in the english one. Copying the relevant section and changing the end result was easy and I just added this to the end of the file.
<dead_diaeresis> <dead_diaeresis> : "\"" diaeresis # DIAERESIS
<Multi_key> <quotedbl> <quotedbl> : "\"" diaeresis # DIAERESIS
<dead_acute> <dead_acute> : "'" acute # ACUTE ACCENT
<Multi_key> <apostrophe> <apostrophe> : "'" acute # ACUTE ACCENT
As I could not find an easy way to reload this, restarting the X server solved the rest.