I am using a keyboard with the "fn" key. This is on a laptop.

So my FN + Up/down/left/right keys are mapped to brightness/volume. I would much rather them be mounted to page up/down, home/end. And map the other 4 keys to these 2. The page up/down has FN+ them for home/end. Its a shitty keyboard layout but I want to make it work.

Anyone knows how to figure out what the keycodes are and how to remap them?

Version: 10.04 x32

So here are some experiments:

Using xmodmap -pke I discovered that keycodes 122 = vol down, 123 = vol up. And I got all the info for Home/End/Page Up (next), Page Down (prior).

Now when using the vol up keys, there are no events being fired that xev can detect.

I can remap the volume keys to XF86AudioLowerVolume or XF86AudioRaiseVolume, but once I map those two to Home/End (respectively) they don't do anything. xev still does not pick up these events after a remap.

Remap: xmodmap -e "keycode 122 = Home"


Some laptop Fn key combinations are multimedia keys (appearing to the OS as ordinary keys with nonstandard codes), while others trigger ACPI events that eventually reach the OS, and some are just handled by the BIOS and never seen by the OS. The information paths are explained on the Hotkeys/Architecture page on the Ubuntu wiki, complete with diagrams.

The KeyTouch program should handle anything that is seen by the OS, and has a friendly GUI for describing your model and configuring what the keys should do (install the keytouch-editor package as well as keytouch).

If the OS can't see anything when you press the brightness keys, it could be because they're handled directly by the BIOS. The battle is not completely lost — it is in principle possible to hack the BIOS — but the difficulty level is considerably raised.

  • I get the error keytouch-editor: No event devices are available in /dev/input/. on launch
    – Jonathan
    Dec 27 '14 at 21:54
  • @JonathanLeaders You should ask a new question, explaining exactly how you ran the program. Be sure to mention which version of Ubuntu you're running. Dec 27 '14 at 22:15
  • 2
    sudo !! was all i had to do =p But keytouch editor can't recognize my keyboard anyway. Trying xbindkeys -v now but it says theres a conflict with another program but doens't say which pid
    – Jonathan
    Dec 27 '14 at 23:30

There is a program called xev that does what you require. I liked the tutorial on setting it up.

  • I tried using xmodmap before. Strangely enough I could remap the volume up key to the brightness up action. And the page up key to the end action. However I could never remap the volume up key to the page up action. It just would not execute, and vice versa. Aug 16 '10 at 18:20
  • 1
    that probably because these keys are mapped directly to graphic card or sound card :)
    – myusuf3
    Aug 16 '10 at 18:56
  • 1
    @Dmitriy: Maybe some of the Fn key combinations produce ACPI events rather than keyboard events. Look in /var/log/kern.log if something appears when you press these key combinations. Even if nothing appears, there may be ACPI events that you can get to see if you use the right tools (sorry, I don't know what the right tools are). Aug 16 '10 at 19:45
  • 1
    The program that remaps is xmodmap; xev is just used to view events.
    – Roger Pate
    Aug 19 '10 at 5:40
  • 3
    -1 dead link for the tutorial. Any chance you copied this info or is it lost forever? Jul 13 '12 at 5:42

The Fn key combinations is not defined in software and can therefor not be redefined, so you need a soldering iron and some electronics knowhow!

  • What??? No I don't care about making the FN key different. Just re-map the events associated with the FN key. As in FN + Left = Volume Down event that the computer recognizes, I just want to change the effect of the event so it appears as if I pressed Home. I mean the keyboard layout is what defines what key does what, how do I modify that. Aug 16 '10 at 17:44
  • 3
    I clearly didn't express my self clearly! But you cant change the predefined values. These combinations doesn't send signals to the OS but directly to the graphics-card/sound-card. Aug 16 '10 at 18:20
  • Oh! Though the OS does recognize that the brightness is changing and the volume too to show this information in the GUI. Aug 16 '10 at 19:05
  • 3
    @Source Lab: On most laptops produced this century or thereabouts, all recognized Fn key combinations either trigger keyboard events or ACPI events. Keyboard events go to the OS; ACPI events can be handled by the BIOS but the OS can intercept them. Aug 16 '10 at 19:42
  • @Gilles Oh. I didn't know that newer computers will send keyboard events. Aug 16 '10 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.