Friday, January 13, 2017

Switching between 3 languages in Ubuntu

I use three languages: English, Russian, and Ukrainian.

Switching between them is a bit tricky. Usually, you type in one of them, occasionally switching to a second one. It is almost never you need to randomly switch between all 3. MacOS keyboard switching mechanism reflects that, with default keyboard language switch shortcut toggling between the two most recently used languages. If you want to switch to the 3rd one, you can use toolbar menu or a separate keyboard shortcut:

When I switched to Ubuntu, the first thing I've noticed is that input switch shortcut cycles through all 3 languages. This is very inconvenient. Of course, I wanted to replicate MacOS behavior. With a little help from Stack Exchange, I was able to do so. Save this script as `` somewhere and make sure it executable:

Then, go to "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add a custom shortcut to it. I use Alt-SPACE. It will cycle between last 2 languages.

P.S. Perhaps I should try to supply a patch or at least open a Gnome bug for this behavior. If anybody familiar with Gnome infrastructure could point me in a right direction I can work on this.