How to configure a kbd layout switch shortcut?

Assume you plug a real keyboard and you want to be able to switch layout with a shortcut (ie Alt+Shift).

Is there a file you can edit? Or another way?

Well, Sailfish uses Wayland, which uses xkb for keyboard input.

So, in theory any options xkb supports should be possible.

Normally you would do something like setxkbmap -option -option grp:<<magic word>> where “magic word” is one of the names defined in /usr/share/X11/xkb/symbols/group. For your preference that would be either lalt_lshift_toggle or ralt_rshift_toggle.

I was under the impression that the compositor handles things like that. Ie in weston there is a weston.ini file where you set up things like that. And the rest of the compositors do their own thing.

Well you’re right. The Compositor sets the actual layout, while xkb is used as a library of possible keys/layouts. So weston.ini configures which layout is used from the large set provided by xkb.

It seems in SFOS this is set via the dconf value /desktop/lipstick-jolla-home/layout, but there you can just specify a language code, not an actual layout.

I don’ t have a physical keyboard at hand to test, but perhaps it’s sufficient to set

XKB_DEFAULT_LAYOUT=us
XKB_DEFAULT_OPTIONS=grp:lalt_lshift_toggle

in the environment and start an application?

After asking a person i trust when it comes to SW stuff the correct way for this to be handled is in the compositor. So probably keyboard support/settings needs to be implemented.

:smirk:

Yeah, sorry for the noise, I really shouldn’t have commented on this. I apologize.