Ubuntu – Re-mapping keyboard keys

keyboard-layout

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"

Best Answer

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.