I have two commands those are binded with CapsLock key and Shift+CapsLock as mentioned in this Q&A Modeless/stateless layout language switching with Caps Lock, again (18.04 LTS Bionic Beaver)
My requirement is to toggle the languages with Super+Space without graphical representation on screen.
I have disabled the default shortcuts for switch to next input source and previous input source.
now I can bind any command to Super+Space like below
Thoughts:
It is possible to give these two commands as two shortcuts for example:
Super+Space for English
Shift+Super+Space for Ukranian
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()"
When the value is 1 in "inputSource[ ]" the language changes to Ukranian and if it is 0 language changes to English
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()"
Question:
I am looking for a command that can read the present value and change to other value among 0 and 1 in the below command so that I can toggle the languages without the need of Shift+Super+Space
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()"
Best Answer
With the help of @danzel, the link provided by him..https://github.com/Nekotekina/kbhook/blob/master/layout_rotate.sh
I have saved the below script as
~/SL.sh
and created a shortcut with Super+Space as/bin/bash /home/pratap/SL.sh
now Super+Space is toggling the Languages without graphical representation which I was looking for..
thanks to @danzel once again