Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active October 9, 2025 09:10
Show Gist options
  • Save ruario/251cecaf1c2784d2ab17dbda43929e20 to your computer and use it in GitHub Desktop.
Save ruario/251cecaf1c2784d2ab17dbda43929e20 to your computer and use it in GitHub Desktop.
Norwegian Macbook Keyboard Tweaks (Ubuntu 24.04)

Norwegian Macbook Keyboard Tweaks (Ubuntu 24.04)

This patch modifies the Norwegian Macintosh keyboard layout on Ubuntu Linux to better match that of a modern Macbook's physical labels and expectations:

  • Replaces | (pipe) with ' (apostrophe) as the primary symbol for the key below esc
  • Promotes $ to Shift+4
  • Introduces as AltGr+4
  • Demotes ¤ (currency) to Shift+AltGr+4 (since this is hardly used these days)
  • Swaps the order of the dead keys of the ´ (acute) and ​`​ (grave) acents on the key to left of backspace
  • Enables access to higher level symbols by setting the right-most Alt ⌥ (Option) key as AltGr

Tested on Ubuntu 24.04 under GNOME Wayland on a "MacBookPro11,1" model from 2013, with a built in Norwegian keyboard.

Instructions

  • Save the following as mac_keyboard_tweaks.patch:
--- a/usr/share/X11/xkb/symbols/no
+++ b/usr/share/X11/xkb/symbols/no
@@ -190,15 +190,15 @@
 
     name[Group1]= "Norwegian (Macintosh)";
 
-    key <TLDE> { [       bar,    section     ] };
+    key <TLDE> { [       apostrophe,   section     ]   };
     key <AE03> { [         3, numbersign,     sterling,     sterling ] };
-    key <AE04> { [         4,   currency,       dollar,       dollar ] };
+    key <AE04> { [         4,   dollar,       EuroSign,       currency ]       };
     key <AE06> { [         6,  ampersand, threequarters, fiveeighths ] };
     key <AE07> { [         7,      slash,          bar,    backslash ] };
     key <AE08> { [         8,  parenleft,  bracketleft,    braceleft ] };
     key <AE09> { [         9, parenright, bracketright,   braceright ] };
     key <AE11> { [      plus,   question     ] };
-    key <AE12> { [dead_grave, dead_acute,        acute,  dead_ogonek ] };
+    key <AE12> { [dead_acute, dead_grave,        acute,  dead_ogonek ] };
 
     key <AD11> { [     aring,      Aring     ] };
     key <AD12> { [ diaeresis, asciicircum,  asciitilde,  dead_macron ] };
@@ -206,6 +206,8 @@
     key <AC10> { [    oslash,     Oslash,   odiaeresis,   Odiaeresis ] };
     key <AC11> { [        ae,         AE     ] };
     key <BKSL> { [        at,   asterisk     ] };
+
+    include "level3(ralt_switch)"
 };
 
 partial alphanumeric_keys
  • Apply the patch:
sudo patch /usr/share/X11/xkb/symbols/no < mac_keyboard_tweaks.patch
  • Set the layout:
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'no+mac')]"

Note: You might need to restart Gnome for the change to apply if you had already set this layout before patching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment