0

I am using the US default keyboard on Linux but sometimes need German special characters. I made my own version of the us file in the usr/share/X11/xkb/symbols folder that has the characters added. That works but always gets overwritten when there are updates.

I saw that there is e.g. a "German, Swedish and Finnish (US)" (de_se_fi) layout in the us file. So I thought I will try that one instead. However I cannot find any of the "German" variants of the US keyboard in the settings to select them.

Update

I found that it is maybe missing in usr/share/X11/xkb/rules/base.lst, so I tried adding it:

These are the lines in usr/share/X11/xkb/symbols/us :

// German and Swedish characters added as third level symbols to the US keyboard layout
// Author: Stephan Lachnit <[email protected]>, 2019
// the german umlauts are placed over the characters without diaeresis, the sharp-s over the s
// the swedish ao is placed over the p, since it's closed to the position on a swedish keyboard
// the euro sign is placed over the e, as it is usual for german and swedish keyboards
partial alphanumeric_keys
xkb_symbols "de_se_fi"  {

    include "us(basic)"
    include "eurosign(e)"
    name[Group1] = "German, Swedish and Finnish (US)";

    key <AC01> {[ a,            A,          adiaeresis, Adiaeresis ]};
    key <AC02> {[ s,            S,          ssharp,     U1E9E      ]};
    key <AD01> {[ q,            Q,          at                     ]};
    key <AD07> {[ u,            U,          udiaeresis, Udiaeresis ]};
    key <AD09> {[ o,            O,          odiaeresis, Odiaeresis ]};
    key <AD10> {[ p,            P,          aring,      Aring      ]};
    key <AD12> {[ bracketright, braceright, asciitilde             ]};

    include "level3(ralt_switch)"
};

I added this line to base.lst (under the ! variant section):

  de_se_fi        us: German, Swedish and Finnish (US)

I also tried creating my own layout usr/share/X11/xkb/symbols/cust_us_de:

default  partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {

    name[Group1]= "Custom US/DE Keyboard Layout";

    include "us(basic)";
    include "eurosign(e)";

    key <AC01> {[ a,            A,          adiaeresis, Adiaeresis ]};
    key <AC02> {[ s,            S,          ssharp,     U1E9E      ]};
    key <AD07> {[ u,            U,          udiaeresis, Udiaeresis ]};
    key <AD09> {[ o,            O,          odiaeresis, Odiaeresis ]};
};

and adding this line to base.lst (under the ! layout section):

  cust_us_de      Custom US/DE Keyboard Layout

Both do not show up when I look for them in SettingsKeyboardInput Sources (also not after a restart)

Is there a way to test whether a layout file (e.g. usr/share/X11/xkb/symbols/cust_us_de) is working or causing an error? Or a way to see which layouts/variants in base.lst are actually loaded?

Do I need to reboot or whatnot to make the changes happen, after editing one of the above mentioned files? Or is it enough to close and open the settings dialog?


System: Manjaro Gnome (wayland)

2 Answers 2

1

The last time I checked, there sadly is no way to do this locally in an easy way. Iirc you need to add your layout /usr/share/X11/xkb/rules/base.extras.xml. However this will be overwritten on every update.

See this commit for an example: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/commit/3deb5d2214e2fe7fbf1c4bb259c1c5fd90619290

Then you need to refresh the cache, on Debian-based distros you do it with sudo dpkg-reconfigure xkb-data, else try sudo rm /var/lib/xkb/*.xkm.

Since it seems you only want to use a subset, I recommend you to just use it and ignore the other keys.

1

Some layouts are hidden with the standard setting in Gnome. To make e.g. “German, Swedish and Finnish (US)” showing up in Gnome settings just go to:

Gnome Tweaks → Keyboard & Mouse and enable “Show Extended Input Sources”.

After restart (logout, login) of Gnome you could find it in the Keyboard layouts under “English (United States)” with the subentry “German, Swedish and Finnish (US)”.

Credit to j-x-n

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .