Keyboard layout issue

Hi all, Qubes noob here. I have successfully installed Qubes 4.0.4, but I’ve ran into an issue I don’t know how to solve. My native language is Portuguese, and it uses fairly often the letter ç (cedilha). Normally to get this letter on Windows, with an English US International keyboard layout, all I need to do is type +c. On Linux, the issue is a bit more complicated, as the result of typing +c is ć, not ç. This can be fixed by setting the keyboard layout as “English US international with dead keys” and following this guide.

I’ve changed the keyboard layout of Qubes (via the Dom0 keyboard tool) to “English US international with dead keys”, but I am unsure how to apply the steps of the guide on Qubes. Perhaps I am missing something but I could not find anything on my search through the docs.

One way to solve this would be to use the brute force method, meaning, go qube by qube and perform this adjustment. I would prefer to avoid that kind of ham-fisted method if at all possible as it would require me to remember to do this on all appVMs I create and my memory is not even remotely that reliable. Does anyone know of a way to set the output of typing +c in a more general way in Qubes?

PS.: I would prefer to keep my keyboard layout English as I live outside of my country and have to frequently type things is 3 different languages. Having to switch keyboard layouts all the time gets frustrating really fast (I’ve tried).

Probably not a solution you want, but did you try to choose the layout you want during the installation?

Hi @fsflover, thanks for the reply.

To be quite sincere I don’t remember which keyboard layout I picked at installation. It was likely some version of English US international as I was already aware of this issue on Linux. I tried cycling through several of the possible layouts to see if any of them would yield the cedilha, but no joy.

Related: Cannot Change VM Keyboard Layout in 4.1

I can confirm a keyboard layout change not affecting keyboard layout inside qubes.

With Qubes 4.0 (If remembered correctly), I just set

setxkbmap -layout "us,nl, ...more..." -option "grp:win_space_toggle" ...

as startup script. The keyboard layout changed for dom0 + all qubes.

With Qubes 4.1 the same only changes dom0 layout, qubes unchanged. Now it is needed to manually invoke

setxkbmap <lang>

inside dom0.

Note: System Tools → Settings Manager → Keyboard → Layout → Use system defaults is enabled (default setting)

moved to ‘User Support’ too

Hi @anybody-01, I tried (on dom0) setxkbmap -layout “us-intl” -option “grp:win_space_toggle” and the output was Error loading new keyboard description. I had the same result with other English US international keyboard layouts.

The only one which did not output the error message, it did not output anything at all, was “us” layout. Afterwards I used localectl status (on dom0) to check the change and both VC Keymap and X11 Layout were set to “us”. I than restarted the appVM I was using to test the changes and checked if the change propagated with localectl status (on the appVM) and it did not. I then proceeded to restart the laptop and check if the change propagated with localectl status (on the appVM) and it did not.

My steps were:

  1. appVM: localectl statusVC Keymap: n/a and X11 Layout: n/a
  2. Dom0: setxkbmap -layout “us” -option “grp:win_space_toggle”
  3. Dom0: localectl statusVC Keymap: us and X11 Layout: us
  4. appVM: localectl statusVC Keymap: n/a and X11 Layout: n/a
  5. restarted appVM
  6. appVM: localectl statusVC Keymap: n/a and X11 Layout: n/a
  7. rebooted laptop
  8. appVM: localectl statusVC Keymap: n/a and X11 Layout: n/a

Did I miss any steps or get any wrong?

PS.: I checked and System Tools → Settings Manager → Keyboard → Layout → Use system defaults is enabled.

Hm good question.

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

works for me in dom0 without triggering an error.

I’ve tried a fresh install of Qubes, setting the keyboard layout to “English US international with dead keys” during installation. This propagated the change to all appVMs, but the c-cedilha issue remains.

I attempted to make the changes from the guide on dom0 and restarting the laptop to see if the changes propagated to the appVMs but, unfortunately, they did not. I then proceeded to try to make the modifications on the templates hoping they would propagate to the appVMs. Once again, they did not.

Apparently, currently, the only path forward is to go with the brute force method and make the changes on every appVM I create. Not very elegant or efficient, but it should do the trick.

2 Likes

just installed 4.1 and updated dom0 and all templates.

I set up a second layout (German with no dead keys) in System Tools → Keyboard → Layout using “Left Alt (while pressed)” for changing the layout option and “Right Alt” as compose key.

When I try to change the keyboard layout via Qubes Manager, I get the following error message: “Please update the cube or its template to the newest version of Qubes tools”.

I also tried setxkbmap and localectl inside a cube. I can switch to German, so that I get the Umlaute. What I don’t get are the characters wo which I normallz use AltGr + something. Means, @, [, ], {, }, Euro sign etc. are not available.

Any hints?

Thx in advance.

Unfortunately, no. I ended up just applying the guide I linked in my original post to each and every appVM. It was tedious to setup, but it works for me. I did not manage to figure out how to “broadcast” the change across all templates/appVMs. If you do figure out a way, please post it here. I would really appreciate it.

Obviously, beside the fact that I don’t know anything about beautiful Portuguese language, I don’t understand what the problem might be here but I just added keyboard layout - Portuguese (no dead keys) in dom0 and here is me typing in AppVM - Çç as SHIFT+; and ; respectively, on a standard QWERTY English keyboard in Qubes 4.1?

Simple ALT+SHIFT and I am back to my English keyboard? Or this is considered as a trade-off? I thought that was the regular use of different keyboard layouts whole my life, ALT+SHIFT being used as often as CTRL+c and CTRL+v?

For me personally, I dislike having to keep switching keyboard layouts. Never managed to get myself accustomed to it. Probably because having to switch between more than 2 layouts kinda breaks the flow. So, I trained myself on how to type in the languages I normally use on a single layout. Which to me feel so much easier and smoother. I guess this kind of setup is mostly a personal preference.

the same here! Already updated everything, but it was already up to date.

The thing is, how did you get the german layout working???
If I set it in system settings, it just has no effect!

And I have also just the same as above: dom0 german layout, TemplateVM VC Keymap: n/a and X11 Layout: n/a

I’m having the same problem by Q4.1, thanks for any hint.

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.

5 posts were split to a new topic: How Qubes installation manages keyboard layout?