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.