3

The keyboard shortcut for switching source is Super+Space. If I press it, this window dialog pops up:

Screenshot of keyboard switcher dialog with en1, en2 and ar

This is quite a slow process. You can press the keyboard shortcut multiple times until you have highlighted the keyboard layout that you need. However, once you have selected it, it seems that you must wait one or two whole seconds before you can type with that keyboard layout and the dialog fades out. Other operating systems let you change keyboard layouts instantaneously, is there a way to do this on Ubuntu?

To be clear, I quite like the window, the window popping up is not the problem. The problem is that it steals keyboard focus. How can I make it not steal keyboard focus? Or is there at least a way to close this window, say with the Esc key?

8

2 Answers 2

3
+500

One blazing fast and radical way to achieve that is modeless and stateless input layout switching. It means, that instead of switching your layouts in cycle (e.g. for 3 languages: US → DE → JP → US → DE → …) you assign a unique combination for every input layout. E.g. Super + F1 for US, Super + F2 for DE, and Super + F3 for JP). Then, every time you need a specific layout you just switch to it.

It's pretty hard to achieve in Ubuntu, as none of the methods that you could Google works properly.

  • The setxkbmap doesn't play nice with the GNOME Shell.
  • The gsettings set org.gnome.desktop.input-sources current is deprecated and doesn't work anymore
  • The gdbus call … org.gnome.Shell.Eval … is also deprecated due to security implications.

So, I've made my own GNOME Shell Extension and I'm sharing it with the world: Shyriiwook (also available @ GitHub: madhead/shyriiwook).

This is a very simple, minimalist extension. It doesn't have any GUI. After installing it, a new D-Bus interface would be exposed in your GNOME Shell session. You could query it for the current configuration or call a method to activate the desired layout:

$ gdbus introspect \
    --session \
    --dest org.gnome.Shell \
    --object-path /me/madhead/Shyriiwook \
    --only-properties

node /me/madhead/Shyriiwook {
  interface me.madhead.Shyriiwook {
    properties:
      readonly as availableLayouts = ['us', 'de', 'jp'];
      readonly s currentLayout = 'us';
  };
};

$ gdbus call \
    --session \
    --dest org.gnome.Shell \
    --object-path /me/madhead/Shyriiwook \
    --method me.madhead.Shyriiwook.activate "de"

This is easily scriptable, and you can even put this command raw into a custom shortcut under the "Settings" → "Keyboard" → "Keyboard Shortcuts" → "View and Customise Shortcuts" → "Custom Shortcuts".

And, just like OP wanted, it happens immediately and doesn't show a popup.

1

It seems that a script can be used to override this extremely annoying behavior. Take a look here:

How to NOT show keyboard layout chooser popup when changing language in GNOME 3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .