swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.69k stars 1.11k forks source link

`xkb_switch_layout next` doesn't switch XWayland layout. #8132

Open YellowOnion opened 6 months ago

YellowOnion commented 6 months ago

Please fill out the following:

I have a custom layout I've been playing around with and applying like so:

$ swaymsg 'bindsym --locked $mod+BackSpace input * xkb_switch_layout next'
$ swaymsg 'input * xkb_layout "us,woob,us"'
$  swaymsg 'input * xkb_variant "dvorak,fhae-wide,basic"'

If I hit $mod+BackSpace twice, my layout switches from dvorak to qwerty, which I can confirm via swaymsg -t get_inputs, but the setxkbmap still reports dvorak as the primary layout.

$  setxkbmap -print -verbose 10
Setting verbose level to 10
WARNING: Running setxkbmap against an Xwayland server
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /nix/store/6jn853xdh1cz78gaqizriirmi2jcbp8i-setxkbmap-1.3.4/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
variant:    dvorak
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us(dvorak)+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us(dvorak)+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

As an aside the geometry is wrong (I use a ansi pc104 keyboard) and I'm unsure why it's displayed wrong, or if sway even bothers parsing it...as it provides no way to introspect this parameter.

sahinf commented 2 months ago

Isn't this an xorg-xwayland bug? Sway uses libxkbcommon, and xorg-x* all depend on xorg-xwayland being a proper bridge, I think?

emersion commented 1 month ago

wlroots might not send the new keyboard layout to Xwayland if an X11 window isn't focused.