Remapping Keys in Linux

I never really had to do this before but I have been using enlightenment for a few months now and use the ALT-(q,w,e,a,s,d,z,x,c) to switch between 9 separate desktops. I find this quite quick but I tried xemacs the other day and I needed ALT-x but I kept switching between desktops. So I decided to use a different key.
Since the Windows key ie the one to the left of the left ALT button is never used I decided to use it to switch desktops instead (I know I will need to use the ALT key in other applications so I might as well do it now before its ingrained into me).
Anyway the procedure goes as follows.
1. Detect the keycode of the key you want changed.
Open a terminal and type
]$ xev
Lots of text should whizz past on the terminal and then stop. Touch the key you want the keycode of and more text should whizz past…. something like
KeyRelease event, serial 25, synthetic NO, window 0xe00001,
root 0x38, subw 0x0, time 24436498, (-298,301), root:(458,320),
state 0x0, keycode 115 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes: “”
We can see that the keycode is 115.
2. Create a user modmap file to be loaded on starting X
]$ cd ~; touch .Xmodmap
and put the following text in it
keycode 115 = Hyper_L
add mod3 = Hyper_L
then edit your ~/.xsession file: Add
xmodmap .Xmodmap
before the “exec enlightenment” line and that should be you sorted. If for some reason you did not have a .xsession file then you will need to add the line to start whatever window manager you are using ie in my case my .xsession looks like
xmodmap .Xmodmap &
exec enlightenment
yours might well be
xmodmap .Xmodmap &
exec sawfish
You should now be able to use the MOD3 modifying key in e16keyedit as a modifier key after restarting xwindows.

Please follow or like:

Leave a Reply

Your email address will not be published. Required fields are marked *