Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active October 9, 2025 09:10
Show Gist options
  • Select an option

  • Save ruario/251cecaf1c2784d2ab17dbda43929e20 to your computer and use it in GitHub Desktop.

Select an option

Save ruario/251cecaf1c2784d2ab17dbda43929e20 to your computer and use it in GitHub Desktop.
Norwegian Macbook Keyboard Tweaks (Ubuntu 24.04)

Norwegian Mac Keyboard Tweaks (Ubuntu 24.04)

This patch modifies the Norwegian Macintosh keyboard layout on Ubuntu as follows:

  • ' (apostrophe) to the unshifted position on the key to match the physical label
  • $ to the Shift position and to AltGR position of the 4 key to match the physical label
  • ¤ to Shift+AltGr on the 4 key (since this is hardly used these days)
  • Reverse the ``​``` and ´ order to match the physical label
  • Alt [Right] set to AltGr

Tested on Ubuntu 24.04 under GNOME Wayland on a "MacBookPro11,1" model from 2013, with a built in Norwegian (labelled) 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