[version Dec. 21 2008 2pm]
Note: this writeup is only for Ubuntu 8.10, which I’m using at the moment. If you know Python it can be adapted to other distributions, it’s a matter of formatting the output style of amixer on your system. Even without changes however, most of these key fixes should work on Fedora 10.
1) The Problem
Normally setting up multimedia and other special keys in Linux involves telling the kernel the keys’ correct keycodes using setkeycodes and perhaps mapping them to X Server behaviors via xmodmap. Unfortunately there is some kind of glitch in Fedora which causes most of the Fn-* keys to loop infinitely. A plausible explanation for this is that only key_press events are being sent to X and not key_release events, but the reason isn’t important here. This problem apparently does not affect other distributions.
In this writeup I give a method to make all (okay, most) of the Fn-* keys work via Ctrl-* instead. Below is a table of the special keys and their current support. After that is a guide for getting Ctrl-* support working on your system.
2) Chart of Special Keys
“Fn Support” indicates status of Fn-* keys. I will not show the hacks here to get Fn-F2 and Fn-F7 working, because they cause problems behind the scenes, wasting CPU cycles indefinitely once pressed.
“Ctrl Support” indicates whether equivalent functionality can be achieved with Ctrl-* post-writeup. The goal of course is to be able to do everything with Ctrl-* and forget about the Fn key, but that has not been achieved yet. For now, both will have to be used.
| Base key |
Fn Support |
Ctrl support |
Behavior |
| Esc |
Yes |
|
Suspend to RAM |
| F2 |
Partial (with hack) |
Yes |
Display Battery Status |
| F3 |
|
Yes |
Insert Euro Symbol |
| F4 |
|
Yes ** |
Toggle Displays |
| F5 |
|
Yes |
Toggle Backlight |
| F6 |
Yes |
Yes |
Toggle Sound |
| F7 |
Partial (with hack) |
Yes |
Launch Default Mail Client |
| F8 |
|
*** |
CPU Mode |
| F9 |
|
**** |
Toggle Wireless Card |
| F10 |
Yes |
|
Toggle Touchpad |
| F11 |
Yes |
Yes |
Num Lock |
| F12 |
|
|
? scroll lock ? |
| PgUp |
Yes |
|
Home |
| PgDown |
Yes |
|
End |
| Up |
|
Yes |
Increase Brightness |
| Down |
|
Yes |
Decrease Brightness |
| Left |
Yes |
Yes |
Decrease Volume |
| Right |
Yes |
Yes |
Increase Volume |
| Windows |
Yes |
Yes |
Whatever You Want |
3) Ctrl-* Writeup
Windows Logo Key
First something easy. The default Linux mapping of the Windows Logo key (Meta) isn’t something most desktop users will find very useful. Type gnome-keybinding-properties at the Terminal and bind the key to something of your choice. I have it launch Terminal.
Other Keys
First install the packages we’re going to need:
sudo apt-get update
sudo apt-get install xbacklight
sudo apt-get install xosd-bin
sudo apt-get install xbindkeys
sudo apt-get install python-virtkey
sudo apt-get install compizconfig-settings-manager
Place my Python script (available here or here) in /usr/bin to guarantee it’s in your path.
Also place my C program (available here or here) in /usr/bin (source available here or here for those who are curious).
Make the files executable with:
chmod +x /usr/bin/nc10_keys.py
chmod +x /usr/bin/battery_xosd
Place my xbindkeys configuration file (available here or here) in your home directory and rename it .xbindkeysrc (including the initial “.”).
Configure the xbindkeys command to be executed at system startup through System -> Preferences -> Personal -> Sessions.
Now start xbindkeys by typing xbindkeys in Terminal and you’re ready to go.
** Ctrl-F4 currently launches CompizConfig Settings Manager, you may want to change this to launch a XRandR multiple screens GUI or something else you have installed.
*** F8 (toggle CPU speed) is not supported by the kernel. I have mapped Ctrl-F8 to launch Pidgin instead, since the running guy looks like the AIM logo.
**** F9 (toggle wireless card) is not a feature supported by the current driver. I have mapped it to launch the default web browser instead.
If you’d like to help me bind the rest of the functions to Ctrl, reading the python script and its comments is a good place to start.