During installation of Ubuntu 20.04 LTS, I chose "Norwegian (Macintosh, no dead keys)" as keyboard layout, because testing it during install indicated that it worked better than my other option "Norwegian (Macintosh)".
I can not get tilde and single quotes, and a whole lot of other special characters, to work.
The problem has existed since my first login. It exists in both the Terminal and GUI applications like LibreOffice and gedit. There is one difference regarding the tilde key: In terminal I get a diamond with a question mark when I try to type it, (unicode replacement character), whereas in GUI applications I get nothing.
Going into Settings -> Region and Language -> Input sources, I can display the keyboard. It shows everything mostly correctly, except it shows an ANSI keyboard layout instead of an ISO keyboard which I have. The tilde is at the expected place, I just can not produce it by typing (it is supposed to be Alt + a regular key), and the single quote is nowhere to be found.
When pressing keys while the keyboard is displayed, it correctly identifies all modifier and regular keys, except two regular keys are switched which is surely related to the ANSI/ISO keyboard issue. That is something I can live with. Each key has four symbols on it, but in the terminal and GUI apps, I can only produce the two symbols on the left, which is produced by either the key alone or Shift+Key. Other modifier keys seems to have either no effect, or trigger some shortcut.
Reading the forums I have tried:
sudo dpkg-reconfigure keyboard-configuration
Here I can either select "Apple" as the keyboard model and end up with the same problem(s), or select "Apple Aluminium ISO", which is my exact model. Most other settings I can change seem either obvious or plain wrong. If choosing Apple Aluminium ISO, after reboot, a Norwegian keyboard layout is selected in the settings, and displaying the keyboard shows the correct form and placement of all keys, but when typing in the Terminal or GUI app it acts like a US keyboard, with all keys in the wrong place and no Norwegian letters "æøå". Choosing "Norwegian (Macintosh)" instead of "Norwegian (Macintosh, no dead keys)" seems to have no effect. Changing keyboard model back to "Apple" resolves this issue, but my original problem persists.
$ cat /etc/default/keyboard
XKBLAYOUT=no,us
XKBVARIANT=mac_nodeadkeys,
BACKSPACE=guess
$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: apple
layout: no,us,us
variant: mac_nodeadkeys,,
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+no(mac_nodeadkeys)+us:2+us:3+inet(evdev)
geometry: pc(pc104)
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+no(mac_nodeadkeys)+us:2+us:3+inet(evdev)" };
xkb_geometry { include "pc(pc104)" };
};
I have had different outputs from these commands before, but the problem stays the same.