You are not logged in.
I have two layouts specified in my sway config, English and Swedish, and used to be able to toggle between then with $mod+space. Part of the config:
input "type:keyboard" {
xkb_layout us,se
xkb_numlock enable
repeat_delay 250
repeat_rate 30
}
[...]
bindsym $mod+space input type:keyboard xkb_switch_layout nextNow it doesn't work anymore and the layout is stuck in English. I haven't been using the computer very much lately so I can't say exactly when it stopped working.
I can toggle manually with swaymsg input "type:keyboard" xkb_layout se and swaymsg input "type:keyboard" xkb_layout us but when I try to set multiple layouts I get an error:
swaymsg input "type:keyboard" xkb_layout "us,se" # Layout is changed to English; output: Error: Unknown/invalid command 'se'
swaymsg input "type:keyboard" xkb_layout "se,us" # Layout is changed to Swedish; output: Error: Unknown/invalid command 'us'/usr/share/X11/xkb/symbols contains both us and se.
"sv_SE.UTF-8 UTF-8" and "en_US.UTF-8 UTF-8" are uncommented in "/etc/locale.gen"
I've tried variations with and without quotes, double quotes, single quotes and also checked the Sway - ArchWiki and the Sway Wiki...but can't get it to work
.
Any help is appreciated.
Offline
I've found that keycodes get messed up when switching layouts, so my solution (on i3, but it should work on sway) is to let xkb handle it:
exec --no-startup-id "setxkbmap -layout dvorak,us -option 'grp:alt_shift_toggle'"Of course, substitute dvorak,us for se,us in your case.
Last edited by natervance (2021-07-29 16:57:04)
Offline
Can't get that to work either.
Putting exec "setxkbmap -layout us,se" in the config didn't help. (Had to remove --no-startup-id as I got "unrecognized option"; guess it's not supported in sway.)
swaymsg exec "setxkbmap -layout us,se" returns same error as before: "Unknown/invalid command 'se'"
My current workaround is a separate keybinding for each keyboard layout, so this isn't really a big issue, more a small annoyance
.
Offline
But not even the -option 'grp:alt_shift_toggle' part made it so you could toggle between layouts? It should make it so that pressing alt+shift switches layouts.
Offline
Nope, that option doesn't make any difference
. I've tried other options too, such as grp:win_space_toggle.
Offline
I have very similar problem after upgrade now
One layout works ok:
sway input type:keyboard xkb_layout cz\(qwerty\)
[ { "success": true } ]sway input type:keyboard xkb_layout us
[ { "success": true } ]but multiple not:
sway input type:keyboard xkb_layout cz\(qwerty\),us
[ { "success": true }, { "success": false, "parse_error": true, "error": "Unknown\/invalid command 'us'" } ]Sorry for my English...
Offline
I have very similar problem after upgrade now
![]()
One layout works ok:
sway input type:keyboard xkb_layout cz\(qwerty\) [ { "success": true } ]sway input type:keyboard xkb_layout us [ { "success": true } ]but multiple not:
sway input type:keyboard xkb_layout cz\(qwerty\),us [ { "success": true }, { "success": false, "parse_error": true, "error": "Unknown\/invalid command 'us'" } ]
I tried this because my configuration stop working after update:
input * {
xkb_layout "cz(qwerty),us"
xkb_options "grp:ctrl_shift_toggle"
xkb_switch_layout "next"
}Nothing in the xkb_layout option works ... I have always english layout...
Last edited by scippio (2023-10-16 12:26:45)
Sorry for my English...
Offline
I found the problem... I commented out this last line in my sway config: "#include /etc/sway/config.d/*" and everything starts worked
EDIT: specifically this file is problem: 95-system-keyboard-config.conf
Last edited by scippio (2023-10-16 12:37:51)
Sorry for my English...
Offline