The official Qubes OS faq entry only covers how to change the layout globally - ie. both for dom0 and VMs, with a single layout.

This document shows several ways of using multiple keyboard layouts and being able to quickly switch between them.

Recommended setup

Run setxkbmap in each VM. Dom0 stays untouched (running setxkbmap in dom0 too will interfere with the VM's setxkbmap setup).

For instance the following command would alternate between the US English and the Bulgarian phonetic layout when pressing both shift keys:

setxkbmap -layout "us,bg(phonetic)" -option "grp:shifts_toggle"

To automatically run the setxkbmap command when the VM starts, add a /etc/xdg/autostart/setxkbmap.desktop file in the VM's template with the following content:

[Desktop Entry]
Name=Configure multiple keyboard layouts
Exec=setxkbmap -layout "us,bg(phonetic)" -option "grp:shifts_toggle"
Terminal=true
Type=Application

Note: for some reason, with Terminal=false the setxkbmap settings aren't applied until one runs setxkbmap without options in a terminal. Setting Terminal=true works around this problem, but you will notice a terminal flicker at startup.

If you prefer to have a per-vm setup rather than per-template, create a /rw/config/setxkbmap.desktop with the same content as above and add the following line to /rw/config/rc.local:

cp /rw/config/setxkbmap.desktop /etc/xdg/autostart

Note: the reason we can't put the setxkbmap command in the rc.local script is because the X server isn't running when rc.local is executed.

Alternatively, you could add the setxkbmap command to your profile's .bashrc file if you use terminals to start applications.

Alternative setups


[details="This document was migrated from the qubes-community project"] - Page archive - First commit: 06 Apr 2018. Last commit: 15 Apr 2018. - Applicable Qubes OS releases based on commit dates and supported releases: 3.2, 4.0 - Original author(s) (GitHub usernames): taradiddles - Original author(s) (forum usernames): @taradiddles - Document license: CC BY 4.0 [/details]