Garuda-setting-manager cannot set keyboard layout in Sway

I want to change the keyboard layout to Swiss German with Macintosh layout in Sway-FX.
I can choose the correct layout in garuda-setting-manager. It prompts me for the admin password but after that it always says that the keyboard layout cannot be set.

How can I change the keyboard layout of console and Wayland to my keyboard, please? I tried a lot with localectl but I cannot figure out how I have to set the keyboard parameters correct. It should be: German, Switzerland, Macintosh-Layout.

Thank you for any hint.

Maybe this article can help: Xorg/Keyboard configuration - ArchWiki

To see a full list of keyboard models, layouts, variants and options, along with a short description, open /usr/share/X11/xkb/rules/base.lst.

In /usr/share/X11/xkb/rules/base.lst, I see this under variant:

  de_mac          ch: German (Switzerland, Macintosh)

And this under layout:

  ch              German (Switzerland)

Those seem like exactly what you want.

Further down in the ArchWiki article, it explains you can set these with a one-liner. Xorg/Keyboard configuration - ArchWiki

Using localectl

For convenience, the tool localectl may be used instead of manually editing X configuration files. It will save the configuration in /etc/X11/xorg.conf.d/00-keyboard.conf, this file should not be manually edited, because localectl will overwrite the changes on next start.

The usage is as follows:

# localectl [--no-convert] set-x11-keymap *layout* [*model* [*variant* [*options*]]]

To set a model, variant or options, all preceding fields need to be specified, but the preceding fields can be skipped by passing an empty string with "". Unless the --no-convert option is passed, the specified keymap is also converted to the closest matching console keymap and applied to the console configuration in vconsole.conf. See localectl(1) for more information.

Obviously I have no idea what model of keyboard you are using; you will have to take a look in /usr/share/X11/xkb/rules/base.lst and see if you can figure that out for yourself, or just leave it blank like this:

sudo localectl set-x11-keymap ch "" de_mac

I hope that helps, welcome to the community @SignurGian. :wave:

3 Likes

@BluishHumility Thank you for your help! After studying your answer and the link I was able to have my keyboard configured the right way. I had to set “pc105” as the keyboard model. Apple related models from /usr/share/X11/xkb/rules/base.lst did not work. I have a MacBook Pro model from 2013:

localectl status
System Locale: LANG=de_CH.UTF-8
    VC Keymap: sg
   X11 Layout: ch
    X11 Model: pc105
  X11 Variant: de_mac

Best regards!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.