Keyboard layout issue

In the TemplateVM, create /etc/profile.d/keyboard.sh:

setxkbmap -layout "us" -option "grp:win_space_toggle"

You can even create a SALT template to create this automatically in TemplateVMs:

Note: I create files in the dom0 home directory and then link to them so that they are included in backups.

~/fs/srv/salt/keyboard.sh:

setxkbmap -layout "us" -option "grp:win_space_toggle"

~/fs/srv/salt/keyboard.sls:

/etc/profile.d/keyboard.sh:
  file.managed:
    - source: 'salt://keyboard.sh'

~/fs/srv/salt/keyboard.top:

base:
  fedora-36:
    - keyboard

~/modifyKeyboard:

cd fs
sudo find * -type f -exec ln -sT $(pwd)/{} /{} \; 
sudo qubesctl top.enable keyboard
sudo qubesctl --all state.highstate
chmod +x modifyKeyboard.sh
./modifyKeyboard

This should be very future-proof because:

  1. When Fedora 37 comes out, you can just add to keyboard.top:
  fedora-37:
    - keyboard
  1. When you migrate Qubes to a new computer, you can just backup dom0, restore, and run ./modifyKeyboard

  2. You can add all your other configuration of the VMs to the SALT file. E.g. installing packages by adding to a .sls file:

my-pkgs:
  pkg.installed:
    - pkgs:
      - syncthing
      - anki

I am just learning SALT myself, so take the above with a grain of salt.

I did not test the exact SALT setup above, so there may be issues, e.g. ~/fs/srv/salt/* may need to be chowned root or chmodded 644. Please let me know if you have any issues.