I installed an i3 for myself. I encountered a problem that switching the keyboard layout does not work.

Problem

The XKLAVIER_ALLOW_SECONDARY event is not triggered because it is raised from libxklavier, which is a dependency of xfce4-xkb-plugin. xfce4-xkb-plugin is a plugin that renders the current layout in the top panel. If we moved from xfce to i3, then it is not started, and the event does not occur, that is, the layout changes only in dom0, and in VMs it is no longer propagated.

Solution

The simplest solution is to run xfce4-panel. To do this, you need to add the following lines to .config/i3/config in dom0:

exec --no-startup-id xfce4-panel

exec_always --no-startup-id setxkbmap -layout 'us,sr' -variant ',' -option '' -option 'grp:alt_shift_toggle'

The first line runs xfce4-xkb-plugin. After that, the layout begins to be propagated into the virtual machines.

The second one adjusts the necessary layouts. -variant ',' must consist of keyboard variants (e.g. qwerty) separated by commas: one variant for each layout. A blank option means that the default option will be used. -option '' clears the entire list of options that was previously set. After that, -option 'grp:alt_shift_toggle' adds an option to change the layout.

You can see your previous layout settings from xfce in .config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xml. I think you can even improve the code to automatically import these values in the i3 config. This will allow you to configure layouts via the GUI - xfce4-keyboard-settings.

Also, consider adding

exec --no-startup-id /usr/lib64/xfce4/notifyd/xfce4-notifyd
to receive dom0 notifications such as starting/stopping qubes and global clipboard actions.