Archive for September, 2007

remapping keys under linux

Sunday, September 23rd, 2007

here’s the problem. i bought a notebook in the united states because it costs about half the price i’d pay for it in switzerland and because i was in the states when all of a certain a need for a new notebook developed (well, to tell you the trouth, it was a spontanous purchase ;) ) anyway.. there is one little problem with that… here in switzerland we have a different keyboard layout. there is no problem in installing the swiss german keyboard layout and using that with the us keyboard except for the fact that the swiss german keyboard has more keys than the us one. the key i miss th most is usually right next to the left shift key and contains the digits “<" ">” and “\”. as soon as you happen to write html code on your notebook, this key becomes quite important ;)

so here’s my plan: i first wanted to remap the useless windows key but i then found out, that a backslash is not possible because for some reasons AltGr is not recognized when pressed together with the windows key. so i decided to use the §° key instead which i need just about as much as the windows key (i am neither a lawyer nor a meteorologist ;) ).

therefore i need to make the key with keycode 49 §° key) behave as if it was the key with keycode 94. Or more precisely, i need to assign the key funcitons “less greater backslash brokenbar backslash brokenbar” to he keycode 49 . in case you are looking for different keys to replace there is a good utility to find out the keycodes

xev

to list all the key functions and their assignment you can use

xmodmap -pke

in order to do the reassignment use the folowing command:

xmodmap -e "keycode 66 = less greater backslash brokenbar backslash brokenbar"

this should now make the §° key become the <> key.

now there’s got to be a way to run this command automatically each time the x window system started, because this only works in x window and can only be invoked after xwindow was started. i haven’t yet figured out where to put that… but i’ll update this post as soon as i know.

Update, Sept. 24
Thanks to Beat i now managed to get the remapping activated upon login to my x window session.
to do so, you simply need to create a new textfile in

/etc/X11/Xsession.d/

i called the file 99remap and it contains the folowing little script

#!/bin/bash
 xmodmap -e "keycode 49 = less greater backslash brokenbar backslash brokenbar"

all files in that directory are automatically executed after the login to a xwindow session. this means, <>\ won’t work for your login or password, but as soon as you are logged-in, the keys are remapped as defined in the file.

stream music from any audio application over a network

Monday, September 10th, 2007