8

Under Xorg, I used ~/.Xmodmap in order to be able to type amongst others a German Umlaut (i.e., äüö) using the right Ctrl key and a, u, o, respectively (as well as Shift for capitals):

remove Control = Control_R
keycode 105 = Mode_switch
keysym e = e E EuroSign
keysym c = c C cent
keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp

I haven't found a way to achieve the same under Wayland using xkb. So far, I've only managed to set my keyboard variant to altgr-intl, which then lets me use right Alt + q, for example, to get an ä.

Since I'm also using Sway, I can't use Alt + Shift + q though for the capital version, because in Sway this is the shortcut to closing a window - and I don't want to remap this.

So, how do I go about putting Umlauts to right-Ctrl + a, u, o, respectively, as I've had it before under Xorg?

1
  • 1
    If you want to remap your keyboard keys or mouse buttons to certain keys, use "Input Remapper" by sezanzeb. It's VERY simple, it has a GUI, and it just WORKS. I just have set a certain shortcut to simulate a keyboard key, works well.
    – Allexj
    Jan 7, 2023 at 12:57

3 Answers 3

2

This solution by GitHub user RedSoxFan uses Alt Gr and/or Caps lock to make Umlauts and works under Wayland / Sway. You get capital Umlauts with Shift. The solution is using a custom keyboard layout:

Save the following to $HOME/.config/xkb/symbols/us-german-umlaut

default partial alphanumeric_keys
xkb_symbols "basic" {
    include "us(altgr-intl)"
    include "level3(caps_switch)"
    name[Group1] = "English (US, international with German umlaut)";
    key <AD03> { [ e, E, EuroSign, cent ] };
    key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
    key <AD09> { [ o, O, odiaeresis, Odiaeresis ] };
    key <AC01> { [ a, A, adiaeresis, Adiaeresis ] };
    key <AC02> { [ s, S, ssharp ] };
};

Then in your sway config, use input type:keyboard xkb_layout us-german-umlaut

2
  • If you want to remap your keyboard keys or mouse buttons to certain keys, use "Input Remapper" by sezanzeb. It's VERY simple, it has a GUI, and it just WORKS. I just have set a certain shortcut to simulate a keyboard key, works well.
    – Allexj
    Jan 7, 2023 at 12:57
  • 1
    @Allexj please don't post comments to suggest different approaches. Instead, post an answer, explaining what this tool is and how to use it to answer the specific problem in the question.
    – terdon
    Mar 13, 2023 at 12:52
0

I don't know hot to achieve your exact request, but you can assign a "compose" key to R-Ctrl, instead, with a similar result.

In Gnome, you can do that with the gnome-tweaks tool. I don't remember about Cinnamon but I'm sure there's a way because I used that as well. (I'm not sure about other DEs, and - as you - I'm not fluent with Wayland).

You can then type R-Ctrl " A to obtain Ä, etc. Note that it's a sequence, not a chord: you type R-Ctrl, then ", then A.

It's not as convenient and quick as your previous solution, but it's more flexible, and gives you access to lots of other fancy characters such as ø æ ⋄ → € ° · … ´ ≠

1
  • 1
    Thanks, but I'm after some configuration that does not require a DE/tool like Gnome, so that it is working irrespective of the DE one is using. Hence my mentioning of xmodmap/xkb. Aug 13, 2019 at 18:50
0

This is actually trivially easy under all "normal" Linux flavors.

Find the "symbols" file your current keyboard is using.

I just recently purchased a Dell Insipiron 3780, which I ordered with the US International keyboard - this keyboard has the Euro symbol on the 5. I also use a wireless Logitech wireless KB/mouse combo model Y-R0042. This has the Euro key on the 5 (in the bottom right of the 5), but otheriwse looks like a normal US keyboard.

I chose the "English (US, euro on 5)" keyboard layout.

This layout is basically defined in the file /usr/share/X11/xkb/symbols/us

You can see that the syntax of this file relies upon the ability to inheret (for lack of a better word) already defined keyboards, so in my case the "English (US, euro on 5) inhereits from "English (US)" which is defined directly above it.

In that definition, you can see all the "normal" letters being defined (or maybe identified is a better word) by their location on the keyboard.

All I did is edit the four lines which actually matter and added the ä,ü,ö,ẞ to the approriate keys, which to my mind are the existing keys a,u,o,s

These are then accessed by holding down the "right-alt" (or possible "Alt Gr") key while typing the english equivalent letter.

So, here is the result of the edits I made for the four lines (I added the final two elements (e.g. udiaeresis, Udiaeresis) to each, previously they were empty):

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

You will have to edit that via "sudo" (as root) Once the you save it, you will have to reload the keyboard, I simply logged out and logged back in, and Shazam !

This is by far the simplest solution I have seen. I suggest that you back up your original file first.

3
  • Can you confirm, you did this under Wayland? I would expect that Wayland doesn't read or know about this file. Sep 24, 2019 at 7:29
  • Ahh, sorry, I didn't notice that part of the question. No, in fact, for some reason I am NOT running wayland - I thought it was defaulting to wayland, but it seems not.
    – SmittyBoy
    Sep 25, 2019 at 8:22
  • This definitely works under Wayland I am using this technique with a GNome40 installation under Fedora 34, and Wayland is running.
    – SmittyBoy
    Aug 12, 2021 at 14:30

You must log in to answer this question.

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