0

I am using Ubuntu 22.04 at work and macOS at home. Both computers have internional keyboards. That means that there is an extra button between left Shift and Z buttons.

However, I have the following problem. I´d like to using this extra button as it is used in macOS: for entering backtick ` and ~ characters because I use them extensively in both operating systems.

The problem is that when I choose "English (UK, Macintosh)" keyboard layout in Ubuntu, it does not allow to use Compose key to enter easily characters like ü and ä. I chose another layout ¨English (UK, Macintosh, intl.)¨ but it has superweird behavior with backticks, tilde, and double quotes as it expects me to enter something directly after that (for example ~n becomes ñ), which makes writing in Markdown or programming code a torture.

Is there a good English keyboard layout in Ubuntu 22.04 that 1) has backtick and tilde between left Shift and Z buttons; 2) Allows Compose button to enter special European characters like ü?

Thanks!

2 Answers2

1

On the English (UK, Macintosh) layout, the backtick and tilde symbols are actually mapped to the key to the left of the Z key.

However...

On some Apple devices, and for some reason, that key is switched with the key to the left of the number 1 key. So I assume that some Apple hardware is involved in your case.

In Ubuntu 20.04 there was a simple way to fix that:

Key '@' (Keycode 49) and key '<' (keycode 94) are inverted on macbookPro keyboard

But that Debian specific feature was dropped in Ubuntu 22.04.

One clumsier way to switch the keys back to their intended state is to edit the file in question directly. It's the /usr/share/X11/xkb/symbols/gb file and this diff shows what can be done:

--- gb.orig
+++ gb
@@ -188,8 +188,8 @@
 key &lt;AE02&gt; {   [               2,              at,         EuroSign    ]   };
 key &lt;AE03&gt; {   [               3,        sterling,       numbersign    ]   };
  • key <TLDE> { [ section, plusminus ] };
  • key <LSGT> { [ grave, asciitilde ] };
  • key <LSGT> { [ section, plusminus ] };

  • key <TLDE> { [ grave, asciitilde ] };

    include "level3(ralt_switch)" include "level3(enter_switch)"

1

This is what worked for me via xmodmap.

  1. Execute xev in the terminal and press the key between Left Shift and Z keys. In the terminal will appear the information about the keycode, which is required for the next step. For me, the keycode is 94.

  2. Add file ~/.Xmodmap with the line

    keycode 94 = grave asciitilde
    
  3. Execute in the terminal

    xmodmap ~/.Xmodmap