Switch the current keyboard layout with the command

I have three keyboard layouts. I want to assign hotkeys for each layout, e.g. CTRL+SHIFT+1 for the first layout, CTRL+SHIFT+2 for the second and CTRL+SHIFT+3 for the third.

What command can I use to set a specific layout? Or maybe my problem can be solved somehow else?

I use Gnome 43.2.

Before Gnome 41, it worked like this: 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()"

How about now?

1 Like

I would use a localectl command.

IIUC localectl will not change the current session keyboard layout dynamically, but rather alter the system defaults, doesn’t it?

I don’t know the GNOME 43 answer, but I’d try asking ibus directlty, like ibus engine xkb:fr:oss:fra (for fr/oss layout here).

Correct, localectl only changes the system locale, not the user session locale.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.