Custom input switch button in GNOME 46

Wed, 20 Nov 2024 15:48
Tags: area:linuxarea:gnome

Status: workaround.

Quality: ugly and hacky.

This year I got tired of fixing issues after KDE updates and decided to look around. I decided to try GNOME, I generally liked the experience so I moved to it permanently.

However, I’m using two input methods and use Shift+CapsLock combination to switch between them. Sadly, GNOME is not letting me set up this combination in the settings. So I googled a bit and found a package called “GNOME Tweaks”. It was a solution that worked well for some time. (I dunno why GNOME is not recognizing this combination in the first place).

What’s wrong with the default Super+Space?

  • It’s less ergonomic for me.

  • Quite often I release Super key with some delay - in this case, I still can see “switching graphics” in the middle of the screen. And it feels annoying (for me).

However, just a few days ago another issue emerged: my Shift+CapsLock combination was cycling not between two input methods (that are set up) in GNOME. But between three. Seems like en_GB appeared additionally and I’m not really aware why. All my keyboard tools (e.g. cat /etc/default/keyboard or setxkbmap -print) report only two input methods (as expected).

So my current workaround is this (not optimal and definitely can/should/will be improved):

  • Disabled CapsLock in GNOME settings and changed its meaning to HyperL.

  • Installed Shyriiwook extension.

  • Created tiny script in ~/.local/bin/ (source).

  • Added custom shortcut in GNOME settings that calls this script.

  • In my case, it was custom2 keybinding:

$ gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ name
'Toggle Keyboard'
  • Finally, I’ve changed the binding for it:
$ gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ binding '<Shift>Hyper_L'