Tilde and singe quote not working on Norwegian mac keyboard

Both Norwegian (Macintosh) and Norwegian (Macintosh, no dead keys) seem to be keyboard layouts which have quite a few 3:rd and 4:th level symbols without automatically defining a key to make use of those.

To set it up, install gnome-tweaks and then:

Tweaks -> Keyboard & Mouse -> Additional Layout Options -> Key to choose the 3rd level and finally check the Right Alt option.

But still: The single quote — apostrophe — seems to have been sacrificed for æ. On the basic Norwegian layout a single quote can be typed by pressing the key to the right of the æ key.

Edit:

One way to fix the single quote:

  • Open the /usr/share/X11/xkb/symbols/no file for editing.

  • Find this line:

    key <BKSL>   { [apostrophe,   asterisk, dead_doubleacute, multiply ] };
    

    at the top of the file in the "basic" section and copy it.

  • Scroll to the xkb_symbols "mac_nodeadkeys" section and paste the copied line into that section.

  • Replace <BKSL> in the copied line with <TLDE>.

  • Do possible other edits to your liking.

  • Save.