A few weeks ago I found a way to assign the Thinkvantage key from my Thinkpad R60 to open a terminal under Ubuntu Intrepid Ibex (8.10). Because most documentation is outdated, I will place and share a little tutorial with you. I will go to all the steps, even those who might be useless for some, just to make sure that everything is correct.
About Ubuntu 9.04 (Jaunty Jackalope): I don’t know if this works in 9.04, but I’m planning a clean install real soon (I talking about 2 – 3 days). You always can subscribe to my RSS-feed to get notification.
- Let’s open a terminal and run:
Then hit the ThinkVantage key. In my case it generated an “ibm/hotkey HKEY 00000080 00001018” event.
- In the “/etc/acpi/events/”-folder you will find the file: thinkpad-thinkpad.
Open it in an editor and you will see something like:
# ThinkVantage/ThinkPad/Blue button event=ibm/hotkey HKEY 00000080 00001018 action=/etc/acpi/thinkpad-thinkpad.sh
- See the file /etc/acpi/thinkpad-thinkpad.sh in the script? Go to the folder and open it.
In my file I had:
#!/bin/sh test -f /usr/share/acpi-support/key-constants || exit 0 . /usr/share/acpi-support/key-constants acpi_fakekey $KEY_PROG1
But for some reason this didn’t work and I changed $KEY_PROG1 to $KEY_MACRO, getting:
#!/bin/sh test -f /usr/share/acpi-support/key-constants || exit 0 . /usr/share/acpi-support/key-constants acpi_fakekey $KEY_MACRO
- Save the file and restart acpid by running the following command in your terminal:
sudo /etc/init.d/acpid restart
- Now it’s time to check our success, run
xevin your terminal and you will get a little window next to your terminal, ignore the terminal for now and click on the little square, then hit the ThinkVantage button and look at the terminal. You will see 2 events, something similar to:
KeyPress event, serial 30, synthetic NO, window 0x2800001, root 0x6a, subw 0x0, time 2000522842, (138,83), root:(781,500), state 0x0, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 30, synthetic NO, window 0x2800001, root 0x6a, subw 0x0, time 2000522842, (138,83), root:(781,500), state 0x0, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False
Really important is “keycode 120 (keysym 0x0, NoSymbol)“, write down the keycode (in my case 120) and close the window.
- Open a new terminal or go to you home folder (in your terminal) and execute the following command: xmodmap -pke > xmodmap.conf
- Open the file and add XF86LaunchA to your corresponding keycode (in my case 120), giving you:
keycode 120 = XF86LaunchA
Note: XF86LaunchA, is a keysyms so you can’t just place something here, you can look up the keysyms in /usr/share/X11/XKeysymDB. I used XF86LaunchA but if you would like to use the ThinkVantage button to do something different you could assign a different keysym. Example, you want to open the default webrowser, then you are better of with XF86WWW.
- Let’s assign this map to the keyboard with the command:
- Again start xev (like in step 5). This time you need to get something like: “
keycode 120 (keysym 0x1008ff4a, XF86LaunchA)“
- This means success but first we want to load xmodmap.conf when Ubuntu starts. To do this, enter the following commands in the terminal:
sudo cp xmodmap.conf /etc/xmodmap.conf cd /etc/gdm/PostLogin sudo cp Default.sample Default sudo gedit Default
Now add to the file:
The first time you will start (or restart) your system, ubuntu will ask to load the file. Offcource, we want to do this so select the file and load it. If you want, you may remove the xmodmap.conf in your home folder at this point.
- Last thing to do is to assign the key to the terminal in System >Preferences > Keyboard Shortcuts.
I hope this tutorial could be of some help. Please leave a comment if you have a suggestion or a problem or just want to say thank you. In the future I will try to update this version to the last release of Ubuntu as soon as I installed it. If you would use this tutorial for commercial use, like placing it in a magazine (online and offline) or book, please donate a small fee.