Using the Thinkvantage key under Ubuntu (8.10)

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.

  1. Let’s open a terminal and run: acpi_listen
    Then hit the ThinkVantage key. In my case it generated an “ibm/hotkey HKEY 00000080 00001018″ event.
  2. 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
  3. See the file /etc/acpi/ in the script? Go to the folder and open it.
    In my file I had:

    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:

    test -f /usr/share/acpi-support/key-constants || exit 0
    . /usr/share/acpi-support/key-constants
    acpi_fakekey $KEY_MACRO
  4. Save the file and restart acpid by running the following command in your terminal: sudo /etc/init.d/acpid restart
  5. Now it’s time to check our success, run xev in 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 0×0, NoSymbol)“, write down the keycode (in my case 120) and close the window.

  6. Open a new terminal or go to you home folder (in your terminal) and execute the following command: xmodmap -pke > xmodmap.conf
  7. 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.

  8. Let’s assign this map to the keyboard with the command:xmodmap xmodmap.conf
  9. Again start xev (like in step 5). This time you need to get something like: “keycode 120 (keysym 0x1008ff4a, XF86LaunchA)
  10. 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: xmodmap /etc/xmodmap.conf
    And save.

    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.

  11. Last thing to do is to assign the key to the terminal in System >Preferences > Keyboard Shortcuts.
    And… SUCCES

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.

6 Responses to “Using the Thinkvantage key under Ubuntu (8.10)”

  1. Michael says:

    Thanks a lot, Stijn. This tutorial worked perfectly for my Thinkpad T43.

  2. LF says:

    Thanks! Worked perfectly.

  3. Michael says:

    Wow! Thanks! I am always looking at the button thinking ‘I wish it did something’!

  4. Nano says:

    Hi STijn, thanks for providing a nice and clear guide for this. I had one problem though. When entering ‘sudo cp Default.sample Default’ I got that the Default.sample does not exist. I edited the file Default instead and it worked. Well, sort of. I can set the think button to open e.g. help browser, but not open a terminal. But… I can open a terminal with a different key combination. Btw, I have Linux mint felicia (similar to Ubuntu 8.10 as I understand) and a T61.
    I don’t expect you to solve this but I wanted to comment. Cheers

  5. Stijn says:

    Thanks for the comment Nano.
    As far as I understand, Default.sample is what it says, just a sample. It could be that Linux mint felicia uses this out-of-the-box.

    Sorry to hear you can’t link the key to the terminal, don’t know what could be the trouble there, can’t help you there.

    And sorry for the late reply, my hoster are changing hardware where my website runs on and there are some problems with mail.

  6. Denny says:

    Greate post,I’ll have a try

Leave a Reply