2

I am using ibus-avro on Ubuntu 20.04. I have 2 input sources: en, bn. I am using F8 to switch the sources. When switching, a large prompt-like thing (I don't know the exact term) is shown on screen. I cannot take a screenshot of it (Print Screen is not working while it is visible), but it looks something like this:

prompt-like thing looks like this

It is annoying, and it also seems to prevent typing for a moment until it goes away. How to hide this and just switch the input source instantly? Thanks.

UPDATE: This issue does not seem that annoying when using Ctrl+Space or Super+Space for switching input sources. In those cases, it only seems to be visible as long as the Ctrl or Super (respectively) key is held down.

CluelessNoob
  • 2,275
  • 3
  • 24
  • 29
  • One way is to create commands and attach them to F8. Otherway is to patch the gnome-shell code. – PRATAP Jun 20 '21 at 15:14
  • SuSpace.sh script in this link is one possibility to bind the script to F8 Key. https://askubuntu.com/a/1198150/739431 – PRATAP Jun 20 '21 at 15:17
  • You can also use gnome tweaks to change the input sources without notification on screen but that don't accept single key from Fn keys – PRATAP Jun 20 '21 at 15:20
  • @UnKNOWn I just tried Ctrl+Space and also Super+Space from the keyboard shortcuts settings and none of them seems to have this issue. However, I would prefer using F8. Need to try the script I guess. – CluelessNoob Jun 20 '21 at 15:30
  • Yes but is F8 Choosable as a Keybinding?? – PRATAP Jun 20 '21 at 15:31
  • @UnKNOWn From here, yes: Settings --> Keyboard Shortcuts --> Typing --> Switch to next input source. That also auto-changes the Switch to previous input source shortcut to Shift+F8. – CluelessNoob Jun 20 '21 at 15:33
  • If you can assign shortcut key to F8.. you can bind F8 to run the above script. Have you tried that? – PRATAP Jun 20 '21 at 15:38
  • 1
    @UnKNOWn Yes, it's working! I modified the script a little bit though (mainly replaced the math variable with $((currentLang+1))), then saved it as an executable, added it as a shortcut from the Keyboard Shortcuts settings, and it works. Thanks. Please post it as an answer. – CluelessNoob Jun 20 '21 at 15:57

1 Answers1

0

Workaround Only

You can create an executable script with below content and bind the script to F8 Key

#!/bin/bash

totalLang=$(gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager()._mruSources.length" | grep -oP "(?<=').*?(?=')")

currentLang=$(gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().currentSource.index" | grep -oP "(?<=').*?(?=')")

math=$((currentLang+1))

if [ "$math" -lt "$totalLang" ]; then
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources["$currentLang+1"].activate()"
else
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources[0].activate()"
fi
muru
  • 197,895
  • 55
  • 485
  • 740
PRATAP
  • 22,460