Skip to content

Layout xkb options are not cleared during propagation #8230

Description

@ya-solnyshko

Qubes OS release

4.1.2 (R4.1)

Brief summary

Keyboard switching pollutes setxbmap options, eventually messing up the key mappings.

Steps to reproduce

  1. Configure multiple keyboard layouts in dom0, e.g., I use the following settings in /etc/X11/xorg.conf.d/00-keyboard.conf:
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "us,ru"
        Option "XkbVariant" "altgr-intl,winkeys"
        Option "XkbOptions" "nodeadkeys,grp:alt_shift_toggle"
EndSection
  1. Start any VM. The state of setxkbmap -print -query is:
user@disp1372:~$ setxkbmap -print -query
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+inet(evdev)+group(alt_shift_toggle)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us
options:    nodeadkeys,,grp:alt_shift_toggle
  1. Switch keyboard layout with Alt+Shift:
user@disp1372:~$ setxkbmap -print -query
....
rules:      evdev
model:      pc105
layout:     ru,us
variant:    ,
options:    nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle
  1. Switch a couple of times more:
user@disp1372:~$ setxkbmap -print -query
...
rules:      evdev
model:      pc105
layout:     us
options:    nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle,nodeadkeys,,grp:alt_shift_toggle

Expected behavior

Normal layout switching.

Actual behavior

  1. First, options get more and more polluted after each layout switch.
  2. Second, after many layout switches, the keycode mapping breaks (perhaps some overflow of options?): the arrow buttons, delete button, and some others get remapped to something random. For example, according to xev, the key Up turns into Print: keycode 111 (keysym 0xff61, Print), same_screen YES
  3. Fixing the layout with xmodmap -e "keycode 111 = Up" fixes the mapping until the next Alt+Shift, then it is messed up again. Resetting the options with setxkbmap -option doesn't help.

It seems that there is some competition between dom0 and the vm itself for handling the keycodes

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: gui-virtualizationThis issue pertains to GUI virtualization in Qubes OS.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.affects-4.1This issue affects Qubes OS 4.1.affects-4.2This issue affects Qubes OS 4.2.diagnosedTechnical diagnosis of this issue has been performed.pr submittedA pull request has been submitted for this issue.

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions