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.

Bookmarks in terminal

Today I found a great tool to ease the navigation in terminal, called apparix. It lets you bookmark a folder so that you easily can navigate to it just by typing

to nameofbookmark

To install apparix in Ubuntu, type

sudo apt-get install apparix

in a terminal window.

After installation you need to set up the aliases “bm” for bookmarking and “to” for going to a bookmark by adding a few functions to your .bashrc file in your home folder (if you don’t have this file, you can create it yourself).

You’ll find the functions you need to add by issuing the command

apparix --shell-examples

in a terminal window. Copy everything below “Bash-style functions” except the “CSH-style aliases”. Paste this into your .bashrc file.

Open up a new terminal, cd to your directory of choice and type

bm mybookmark

to bookmark the folder. Afterwards you can go to any folder and type

to mybookmark

to go to your bookmark.

This tool is of course available for other Linux distributions too.

Spotify for Linux

Awesome news! Spotify is now finally available as a native client for Linux. I have no idea why I haven’t spotted this earlier, as it was already announced in July, but in any case it is finally here.

Although they call it a preview, it seems to be a very finished and good-looking product, and I finally might get rid of those annoying sudden playback stops I experienced while Spotify under Wine. At least I haven’t experienced any of them yet.

I wish they would release it as an open source application as well, but for now, I’m very satisfied seeing that the money I’m spending on it pays off for Linux users as well. At the moment though, it seems like it is only packaged for Ubuntu and Debian, but hackers using other distros out there are probably going to figure out how to run it on other machines.

Now I’ll be hoping for a native version for N900, as most of the projects attempting to run Spotify on Maemo appear to be left unusable each time Spotify updates their API.