2

I'm Swedish and occasionally write in Danish and Norwegian. For this, I do not switch keyboard layouts, just type AltGr + ä to get æ and AltGr + ö to get ø, the only Danish/Norwegian letters not available on my native Swedish keyboard. Now I'm learning Russian and for this I switch to a keyboard layout called "Russian (Swedish, phonetic)", which is available in Ubuntu Linux 16.04.

But I also sometimes need to type words from Ukrainian and Belarusian which have some extra letters. For this, it would be very convenient to just type AltGr + и to get the Ukrainian і and AltGr + э to get the Ukrainian є, not having to switch between so many layouts. But currently, this keyboard layout doesn't seem to make any use of AltGr at all. So how do I accomplish this, and how can the improvements be distributed with the next release of Ubuntu Linux?

My work-around, which is far less convenient, is to switch to the layout "Ukrainian (phonetic)". Having to switch between three layouts is awkward and should not be necessary in my situation.

1 Answers1

3

Here's my path towards answering my own question(s): The file I need to edit is

/usr/share/X11/xkb/symbols/se

That file contains both the regular Swedish layout (where AltGr + ä = æ) and the "Russian (Swedish, phonetic)". Still, I edited the Russian section of this file, and nothing happened. From previous years, there are many forum posts discussing why xkb edits don't take effect. One common answer was that a cache file in /var/lib/xkb had to be removed, but there was no such file on my system and in Ubuntu 16.04 there is no need to remove it. But rather, the Russian section of the file contained a line key.type[group1]="ALPHABETIC"; that I had to comment out. I don't know why that line was there or what it was supposed to do. After I commented this line out, I can now add AltGr definitions as number 3 and 4 on each line, and they take effect the next time I switch between keyboard layouts. So I modified the following lines:

key <AE12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, U0301, U0300 ] }; // acute, grave
key <AD01> { [ Cyrillic_ya, Cyrillic_YA, U0463, U0462 ] }; // Yat
key <AD03> { [ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ] };
key <AD07> { [ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ] };
key <AD08> { [ Cyrillic_i, Cyrillic_I, Ukrainian_i, Ukrainian_I ] };
key <AD11> { [ Cyrillic_e, Cyrillic_E, Ukrainian_ie, Ukrainian_IE ] };
key <AC05> { [ Cyrillic_ghe, Cyrillic_GHE, Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] };
key <AC07> { [ Cyrillic_shorti, Cyrillic_SHORTI, Ukrainian_yi, Ukrainian_YI ] };

The first line adds a combining acute accent on AltGr ъ and combining grave accent on AltGr Ъ (the ´` key), which is useful if you write Russian dictionaries where accents are used: мо́ре, моря́. In contrast to Latin letters, Unicode does not contain code points for Cyrillic vowels with acute accent, so these combining accents are needed.

The next lines add ў for Belarusian, ѣ (yat) for pre-1917 Russian spelling, ї, ґ, є for Ukrainian, і for all three orthographies, and puts ё on AltGr е for convenience. Maybe you disagree with the positions. Should AltGr и = і or ї? It is more obvious that AltGr г = ґ and AltGr у = ў.

With this, I'm mostly happy. What remains is to get this into the next Ubuntu distribution. How? Who?