1

Here's my input settings (notice the order of the languages in the list which is my preference.)

enter image description here

Now initially when I invoke the shortcut to switch the input the list looks like that (as expected) :

enter image description here

Now I select Korean input (second item) and invoke the switch shortcut again, here's how the list looks like :

enter image description here

As you can see the order changed.
And now if I select another input and try to switch again the list is completely shifted.

Is there a way to prevent gnome from rearranging the list all the time ?

I think it's worth mentioning my job is about languages and I switch languages all the time (searching a chinese character, going back to english keyboard, going back to a korean dictionary to find out a definition, etc ...), I found that the brain remembers more easily the location of the languages in the list rather than what's actually written, and that's how Windows do.
I wish there's a way to fix that, if not I would have to report that as an issue on the gnome website.

Thanks in advance.

8
  • gnome is enough detail but can you also mention your 0S??
    – PRATAP
    Dec 22, 2019 at 15:47
  • @PRATAP my OS is fedora. Thanks for providing this link which is helpful, this is exactly what my question refers to. Unfortunately it seems that gnome still haven't provided a solution to this problem regarding the bug report is 2 years old. After all one solution would be to make a script that waits for the shortcuts and then call a tool like localectl to change the input. But I wish that was a built-in option. again thanks for your help.
    – vdegenne
    Dec 22, 2019 at 16:34
  • @PRATAP i will try using xbindkeys thanks for suggestion
    – vdegenne
    Dec 22, 2019 at 16:48
  • so, your requirement is Visual + Static Changing rite..?? where Super+space doing visual but not other and Shift+Alt is doing Static and not other.. Correct?
    – PRATAP
    Dec 22, 2019 at 16:50
  • @PRATAP Correct. ah yes right, the problem with the solution proposed in the link (Alt+Shift) is that it lacks a visual feedback, and can't use shortcut for previous (like win+shift+space to go back one input). So it's not really satisfying. Again I switch often the languages and it's more easy to memorize the location of the current input (highlighted) and move from 1, 2, 3, 4, ... positions. Do you understand ?
    – vdegenne
    Dec 22, 2019 at 16:56

1 Answer 1

1

Since, there is no gnome-shell-extension as of now for the static shifting of keyboard layout using default shortcuts Super+Space and Shift+Super+Space..

and the comments about this link Static ordering of keyboard layout switching in Ubuntu 17.10 and later with GNOME 3 from OP

the problem with the solution proposed in the link (Alt+Shift) is that it lacks a visual feedback, and can't use shortcut for previous (like win+shift+space to go back one input). So it's not really satisfying.

I could achieve at least one point out of two (Visual Feedback & Switching back to previous layout) with below workaround.

Workaround

OS: Ubuntu 19.10

Reference: Manipulate the Default Shortcut Super+Space for Switching to Next Input Source without Graphical Representation

Create two scripts with below contents, I have named those as "SuSpace.sh" and "ShSuSpace.sh"

SuSpace.sh

#!/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 "(?<=').*?(?=')")

declare -i 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

ShSuSpace.sh

#!/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 "(?<=').*?(?=')")

declare -i math=$currentLang-1

if [ "$math" -eq -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["$totalLang-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["$currentLang-1"].activate()"
fi

you can create custom shortcuts for these two scripts as per your wish.

enter image description here

1
  • 1
    Thanks a tone!!!! I placed these 2 scripts in /usr/local/bin and used gnome shortcuts interface and now it works perfectly! That's like a Christmas gift in my busy days:) I will definitely try to find a tool for visual feedback but now that I have the backbone I should have the motivation. I don't know how to thank you, again thanks..
    – vdegenne
    Dec 23, 2019 at 20:23

Not the answer you're looking for? Browse other questions tagged .