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!

10 Responses to “Norwegian mac keyboard layout in Ubuntu”

  1. Diderik From Says:

    Thank you for this excellent guide! It solved my problems! However, on my MacBook and Ubuntu 8.10 I needed to make som extra changes. The following is what I edited the section under “// Copied from macintosh_vndr/no” to.

    key { [ apostrophe, section] };
    key { [ less, greater, guillemotleft, guillemotright ] };
    key { [ 3, numbersign, sterling, sterling ] };
    key { [ 4, dollar, currency, dollar ] };
    key { [ 6, ampersand, threequarters, fiveeighths ] };
    key { [ 7, slash, backslash, bar ] };
    key { [ 8, parenleft, bracketleft, braceleft ] };
    key { [ 9, parenright, bracketright, braceright ] };
    key { [ 0, equal, notequal, degree ] };
    key { [ oslash, Ooblique, odiaeresis, Odiaeresis ] };
    key { [ plus, question ] };
    key { [ ae, AE ] };
    key { [ aring, Aring ] };
    key { [ dead_grave, dead_acute, acute, dead_ogonek ] };
    key { [ diaeresis, asciicircum, asciitilde, dead_macron ] };
    key { [ at, asterisk, endash, emdash ] };

    Thanks!

  2. Diderik From Says:

    Sorry about that useless list. It seems that certain symbols cannot be typed into this reply box, and thus cutting and pasting does not work. Anyway, the most important changes I needed to do to make this work on my MacBook was:

    Add key LSGT and defining apostrophe and section.
    The TLDE must be less and greater.

  3. Ole Bakstad Says:

    Oh, I forgot to mention that in my post. I actually had to do the same thing with my apple alu keyboard, thanks for the reply.

  4. Apple Kayboard su Ubuntu: come mappare il tasto backslash | zenetic Says:

    [...] lunghe ricerche, trovo finalmente la discussione illuminante e, con un solo clic, Ubuntu riconosce correttamente i due [...]

  5. Anders Rønningen Says:

    I’m on a unibody MBP with Norwegian layout and this tip didn’t quite do it for me.

    To fix the two swapped keys, it seems to do the trick to run: xmodmap -e ‘keycode 94=apostrophe asciitilde apostrophe asciitilde dead_grave dead_horn’ -e ‘keycode 49=less greater backslash brokenbar backslash brokenbar’

    Haven’t yet found out how to make it permanent/run at boot.

    When I apply the trick to choose the 3rd level chooser, I lose the ability to use my F-keys (like fn+alt+f2 for run-application). Any clue what I might do to fix this?

  6. Sirupsen Says:

    Hello!

    Thanks a lot for your post, works great. I took your steps, and then did what first comment did as well. However, i had to change the last key:
    key { [ at, asterisk, endash, emdash ] };

    Into:
    key { [ apostrophe, asterisk, at ] };

    Hopefully that’ll help some other people to get this working.

  7. Anders Rønningen Says:

    I am still on a MacBook Pro, but now this works much, much better. Only issue left for me is that the-key-above-the-tab-key still doesn`t give me apostrophe. It gives me the following:

    | (key)
    § (shift + key)
    ¬ (alt + key)

    Anyone got any ideas?

  8. Ole Bakstad Says:

    Are you sure you have changed the value of <TLDE> to:

    key <TLDE> { [ apostrophe, paragraph, bar, brokenbar ] };?

  9. Quintin Devon Says:

    Hey – I’m speaking to a ton of webmasters to find out out if they’ve heard something in regards to the implausible weblog site page engine change that is contained in the works? With WP releasing 3 moderately shortly, the phrase on the street is that BE goes to make an amazing quantity of adjustments that search like WP alterations. Shoot me an e mail occasion you occur to ever take heed to everything.

  10. Martin Says:

    Hi!
    I Just wondered if you by now have made your own layout equivalent to the mac os x layout?

    I’ve looked into writing my own, but my skills aren’t that good, and I haven’t obtained a list over syntax’/names for symbols to use in the no-file.

Leave a Reply