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
    I think the behavior of AltGr you describe needs a keyboard layout with "dead keys". Check if such a variant is available for the "Russian (Swedish, phonetic)" layout. – terdon May 11 '17 at 17:21
  • For Cyrillic alphabets, you might do better with an input method (ibus or fcitx) rather than keyboard layouts. – chaskes May 11 '17 at 19:37
2

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?

  • Great that you figured it out. If you think it's of general interest to people who type cyrillic using a Swedish keyboard, you can make a request by filing a bug report. If you don't know how to create a git patch, let me know the bug number and I can help with that. – Gunnar Hjalmarsson May 11 '17 at 19:57
  • Is there any way I could get in touch with other users of this layout and discuss what the best mapping would be? When searching for the answer, I found some blogs that thought it was weird to map ж (zh) to the "v" key. Maybe that should change? Maybe ё (now on the ½§ key) should be on AltGr е, and ѣ should be on AltGr ь instead? Or maybe ъ should be on AltGr ь? Which is better? The current source file is signed "Ivan Popov, 2005-07-17". – Lars Aronsson May 11 '17 at 21:24
  • I don't know how to find other users of the layout, and I would advise against moving around symbols without some kind of consensus. Adding a few symbols, as you showed above, ought to be uncontroversial. – Gunnar Hjalmarsson May 11 '17 at 22:33
  • In the "ru" file, there is an interesting layout called "RUU" or Russian-Ukrainian united, based on the Russian, which pairs these letters: у-ў, е-ё, г-ґ, ъ-ї, ы-і, э-є (AltGr у = ў). – Lars Aronsson May 11 '17 at 23:52
  • Sure, but that layout is most certainly used by other users, so it doesn't help us. Let's stick to additions when modifying the Swedish variant. – Gunnar Hjalmarsson May 12 '17 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.