Norwegian mac keyboard layout in Ubuntu
February 23rd, 2009
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:
- Change 3rd level chooser and switch Alt / Win (cmd) key.
- Edit the XKB-file to get keys right.
- 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!
March 28th, 2009 at 19:15:22
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!
March 28th, 2009 at 19:23:27
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.
March 30th, 2009 at 13:18:03
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.
May 11th, 2009 at 19:31:57
[...] lunghe ricerche, trovo finalmente la discussione illuminante e, con un solo clic, Ubuntu riconosce correttamente i due [...]
July 19th, 2009 at 14:29:59
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?
August 5th, 2009 at 21:25:21
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.
August 14th, 2009 at 22:03:05
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?
August 16th, 2009 at 22:18:58
Are you sure you have changed the value of <TLDE> to:
key <TLDE> { [ apostrophe, paragraph, bar, brokenbar ] };?
July 25th, 2010 at 10:39:59
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.
July 30th, 2010 at 16:37:52
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.