Disable Popup Notification on Ubuntu 18.04 Language Switch

Recently i installed Ubuntu 18.04. I added a Bengali keyboard layout and set the shortcut to switch between languages. The problem is when i press the shortcut key a popup notification appears and the keyboard fridges for about 3 seconds.

How can i disable this notification popup and get relief from the keyboard fridge issue.

I installed gnome-tweak-tool application and there is a way out of this. There is a list of preset shortcut keys to switch languages and can be enabled any or multiple of them.

For a long time i use F12 as the shortcut key. I want to use F12 and the popup disabled too.

enter image description here


Solution 1:

Assuming you only have two languages set..

create a script with below content..

#!/bin/bash

CURRENT=`gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().currentSource.index"`

if [ "$CURRENT" == "(true, '1')" ]; then
  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()"
else
  gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().inputSources[1].activate()"
fi

Create a keyboard shortcut with F12 like below..

enter image description here

enter image description here

You can see the language changing with F12 button pressed in the above gif.

Further Reading