Monday, May 12, 2008

Special Keyboard or Remote Keys and Binding

I have a remote that has buttons on it not recognized by ubuntu. In order to get the remote to behave the way I would like I just want to bind some buttons to different keys, here's how I do it.

1. xev - This command will open a window and print the keycode for whatever key you press. For my new remote I press the key with a "<-" on it and I get this:

KeyPress event, serial 28, synthetic NO, window 0x1c00001,
root 0x13b, subw 0x0, time 113488598, (381,88), root:(388,139),
state 0x10, keycode 234 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
2. vi ~/.xmodmap - create this file if it doesn't exist and use it to add your new keys. I want the back button to be the "escape" key, as that exits and/or backs up a menu level. so I open .xmodmap and type something like:
keycode 234 = Escape
3. xmodmap ~/.xmodmap - this will add my new key binding to the map and immediately should start working.

Add this to start-up if you want it to always load on boot.

No comments: