1

I'm trying to create a custom keyboard layout to fit my needs, based on the US layout.

What I want

  • Alt + Ctrl + u = ü
  • Alt + Ctrl + Shift + u = Ü

(same way for ö, ä, and ß)

Why?

  1. Because getting used to the German keyboard is not how I want to waste my time
  2. The hotkeys for the international one aren't convenient for me
  3. Installing 3rd party software like autokey is not a good idea either: it's another daemon running somewhere instead of the kb being native (but layout editor is an ok solution)

System

Xubuntu (Ubuntu + Xfce) 22.04

What I've tried

There quite a lot of answers on this forum for this question. Many just go with the available layots.

And there are more I tried, that are either too complex, or me too stupid/lazy. If there's a good guide on what I want to actually do, I'd be very thankful.

  • Welcome to AskUbuntu, one of the solution is using xbindkeys, another is registering keyboard shortcuts in your setting. https://askubuntu.com/questions/254424/how-can-i-change-what-keys-on-my-keyboard-do-how-can-i-create-custom-keyboard/254442#254442 – Sadaharu Wakisaka Jun 27 '22 at 00:22
  • https://ictsolved.github.io/remap-key-in-linux/ . What you want is "mapping". The link explains the basics to map keys. . Keyboard, language, region are set early during a fresh install. For me, a fresh install requires usually 20 minutes. 20 minutes may be considerably less time than attempting to remap a keyboard from English to German, and a fresh install ensures no bugs. – rob grune Jun 27 '22 at 00:25
  • @SadaharuWakisaka I wouldn't like to to register it as shortcuts. Regarding xbindkeys, as far as I understand it's also binding shortcuts, instead of editing the actual keyboard layout.

    @robgrune I couldn't quite figure out how to do it with Alt+Ctrl+u. The second way described in the article is close to what I want, I already tried editing symbol files, but I didn't understand how to do it with Alt+Ctrl.

    – WhiteBlackGoose Jun 27 '22 at 07:32
  • 1
    With US International, " + u gives ü, same with "Shift" gives Ü. AltGr+s gives ß, etc. It will be way easier to change to the US Int keyboard layout than to try writing your own layout. – vanadium Jun 27 '22 at 08:16
  • You can define the 3rd level CTL+ALT and 5th level shift CLT+ALT+SHIFT key(s). And you can edit your keyboard layout and add ü and Ü. `key { [ u, U, NoSymbol, NoSymbol, udiaeresis, Udiaeresis ] };`` – Sadaharu Wakisaka Jun 27 '22 at 10:21

2 Answers2

1

It turned out that even with regular US layout you can do

  • Compose + " + u = ü
  • Compose + " + U = Ü
  • Compose + " + a = ä
  • Compose + " + A = Ä
  • Compose + " + o = ö
  • Compose + " + O = Ö
  • Compose + s + s = ß
  • Compose + S + S = ẞ

and I guess I'm satisfied with that. To set the compose key, go to keyboard -> layout, there's a dropbox for changing the compose key

0

cat /usr/share/X11/xkb/symbols/us

 key <AD07> { [ u, U, NoSymbol, NoSymbol, udiaeresis, Udiaeresis ] }; 

Set your CTL+ALT as a level5 shift and CTL+ALT+SHIFT would be a level6 shift.

  • Almost there. But how do I set ctrl+alt as level3 shift? I honestly have no idea what it means. – WhiteBlackGoose Jun 27 '22 at 11:56
  • I do not know which exact keys you want to apply. Control_L, Control_R, Alt_L, Alt_Graph, ... There are so many candidates. xev get the code. You also may do it by gnome-tweaks, if you are okay with one of the combinations offered by default. cat /usr/share/X11/xkb/symbols/de read the file and find 3rd/5th level modifier key then you understand. – Sadaharu Wakisaka Jun 27 '22 at 17:52
  • I want Alt_L + Control_L (+ Shift_L). I don't understand how to set it as level3 (and I don't honestly what "level" is here). (thanks for your help btw, I just don't understand a few remaining things) – WhiteBlackGoose Jun 28 '22 at 19:08
  • It's simple u and U is the level 2 shift. Normally the Alt_Graph key is set to 3rd level shift on the German keyboard layout or so. If you want a new level 3 shift, then NoSymbol should be udiaeresis. Now xmodmap -pm can set these nth level shifts. But I warn you, ART_L + CTRL_L is already used for the important shortcuts. – Sadaharu Wakisaka Jun 29 '22 at 00:09
  • Sorry. I genuinely don't understand. I see that German keyboard somehow mentions words level3 and level5 (cat de | grep level). I also see that "xmodmap -pm" printed some keycodes. I added what you said to my layout, but I still don't get umlautes. – WhiteBlackGoose Jun 30 '22 at 14:48
  • You are the programmer and able to code something. https://askubuntu.com/questions/41213/what-does-key-to-choose-5th-level-in-gnome-keyboard-properties-do – Sadaharu Wakisaka Jun 30 '22 at 21:43
  • Thanks for your attempt to help. I still didn't get how to set those levels, and spent too much time on it either way. But it turned out that there are hotkeys out of the box, so I posted info about it in another answer – WhiteBlackGoose Jul 01 '22 at 09:36
  • I am telling you, AltGr + u = ü for the solution, everybody else in Europe who does not use Umlauts every day. Your answer to using compose key is in this forum more than a dozen times in the past. Please search before asking. – Sadaharu Wakisaka Jul 01 '22 at 10:36