KMilo is a KDE plugin providing binding for some special Thinkpad keys. It is a KDE port of tpb.
KMilo is available in Portage.
emerge kmilo -av
apt-get install kmilo
You will probably have to edit /etc/udev/permissions.rules and replace the line
KERNEL=="nvram", MODE="0666", GROUP="nvram"
This will make the nvram module writable for everyone so that your settings will remain when you reboot.
After installing an entry called "IBM Thinkpad Laptop" will appear in your KDE Control Center under "System Administration". This lets you choose the program to execute for each event.
You can use appropriate commands to inject fake keystrokes.