For the last years I’ve been using Mac OS X, but now I’m running Ubuntu. Ubuntu has very much functionality build in, but the Norwegian mac keyboard layout isn’t that great out of the box.

There are three steps required to get the layout partially[NB!] right:

  1. Change 3rd level chooser and switch Alt / Win (cmd) key.
  2. Edit the XKB-file to get keys right.
  3. Set the keyboard in  Ubuntu to “Norway Macintosh”
Step 1:

Open the keyboard settings (System -> Preferences -> Keyboard) and click the “Layouts” tab. Then click the “Other options…” button.

1.1) Press “Alt/Win key behavior” and choose “Left Alt is swapped with left Win-key”.
1.2) Press “Third level choosers” and select “Press any of Alt keys to choose 3rd level” (or “Press left Alt keys to choose 3rd level”).

Step 2:

This part is a bit more tricky.

Open the terminal and open the folder “/usr/share/X11/xkb/symbols”

$ cd /usr/share/X11/xkb/symbols

The file we are going to edit is named “no”, but before we begin lets backup the file!
From now on every command run as root (noted by #).

# cp no no_backup

Now open the “no”-file with your favorite editor, I’m using VIM.

# vim no

Scroll down to the part which starts with:

// Copied from macintosh_vndr/no
partial alphanumeric_keys
xkb_symbols "mac" {

You now need to change the following lines:

key <TLDE>  { [      bar,    section, brokenbar, paragraph    ] };
to:
key <TLDE>  { [      apostrophe, paragraph, bar, brokenbar ] };

And:

key <AE04>    { [         4,  currency,       dollar,       dollar ]    };
to:
key <AE04>    { [         4,   dollar,       currency,       dollar ]    };

Then save.

Step 3:

The only thing remaining is to select “Norwegian Macintosh” as your default keyboard layout.
In System -> Preferences -> Keyboard, press the “Layouts”-tab and press the “+”-button.

If everything is done right you should have the basic Norwegian mac layout.

NB!

This layout is not equivalent to the real Norwegian mac layout. There is a lot of keys that needs mapping to do so. The original layout looks like this (keys are pressed from left to right).

Edit:

It seems that if you use the newer versions of Apple’s keyboard you have to change the setup for the TLDE-key and the LSGT-key. I don’t know why, but it works!