0

I'm using Ubuntu 20.04.01.

TL;DR - Gboard on my phone cycles through languages in a way that, when you switch language, the layout changes to whatever layout you recently used (kinda like swapping tabs in VSCode). Is there any such feature on Ubuntu?

I have three keyboard layouts in use- English, Hebrew, and Japanese (MOZC). I am Bilingual and I use both English and Hebrew very often. Japanese is installed because I've recently started studying the language. I use the Japanese keyboard to type when I'm making my flashcards or when I'm practicing, but I don't use it in daily life. This means when I'm typing in English and my mom messages me in Hebrew and I wanna reply in Hebrew, it's always the same thing of I switch the language, start typing, notice it's all Japanese, erase everything, swap to Hebrew and then type it all over again.

The keyboard on my phone, Gboard, has a simple solution for this - it swaps between keyboard layouts the same way VSCode swaps between tabs - recently used last. If I turn on my phone, type in Hebrew, then swap to English and type more, the next time I press the keyboard change button It'll swap to English again. It'll only switch to Japanese if I press the keyboard change button, then press it again without typing anything.

I've been Googling for a bit now trying to figure out if such a thing exists for my computer as well, but I haven't found anything. I'd love it if anyone could give me some pointers in the direction!

Noga S
  • 45
  • @GunnarHjalmarsson That's embarassing, you're totally right. I've been using Alt+Shift set in the Tweaks settings ever since I've started using Ubuntu, so I never knew. Thank you so much. (I don't know if I can mark your comment as the answer, but either way it's solved now) – Noga S Sep 27 '20 at 07:25
  • I moved the comment to an answer. – Gunnar Hjalmarsson Sep 27 '20 at 09:26

2 Answers2

1

The default mechanism on Ubuntu for switching input sources, i.e. Super+Space, basically works like that.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
1

In recent Ubuntu versions with default GNOME desktop it works exactly like that (at least in my case with Ctrl+Space shortcut). But in Unity desktop it's still a problem...

The workaround for Unity is to use ibus switcher which provides the mru-switching functionality out of the box. It is used by Unity and installed along with it by default usually. (If not, install it and set at System Settings -> Language Support -> Keyboard input method system.)

You can configure it with ibus-setup gui (run from terminal): 1) in Advanced tab uncheck 'Use system keyboard layout'; 2) add your languages in 'Input Method' tab; 3) add your switching shortcut in 'General' tab.

Now, delete the shortcuts in Unity's config at System Settings -> Text Entry and untick 'Show current input source in the menu bar' - it won't work with ibus switcher anyway.

Now you all set and it should work. If you could not find your language in ibus (like it happened to me with English (UK)) - you can manually add it easily, check the workaround here - https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/1540587.

One more last thing: if you want to see the current language indicator in the menu bar – try gxkb. (You can add it to Startup Applications to start automatically.)

See also the similar question at How can I quickly switch between two out of multiple languages?.

Andriy
  • 59