Modifying keys on a Norwegian Linux keyboard to resemble those on a Mac
A friend of mine is switching between a Mac and a Linux machine, causing some readjustment whenever he switches keyboards. The most urgent fixes were to move the curly and square braces together with the backslash and dollar sign. Basically to map the keys as follows:
ALT + 8 = [
SHIFT + ALT + 8 = {
SHIFT + ALT + 7 = \
SHIFT + 4 = $
To set up these fixes, the first thing you need to do is to go to System Settings and Keyboard Layout (might be hidden under Region and Language) and select advanced options. Here you need to enable “Key to choose third level: Left Alt”.
The next is to run the following commands:
xmodmap -e "keycode 13 = 4 dollar 4 currency dollar onequarter"
xmodmap -e "keycode 16 = 7 slash 7 slash braceleft backslash"
xmodmap -e "keycode 17 = 8 parenleft 8 8 bracketleft braceleft"
xmodmap -e "keycode 18 = 9 parenright 8 8 bracketright braceright"
To store these settings permanently, create a file named .bashrc in your home folder and add them to this file.