MULTI MEDIA KEYS IN LINUX
NOTE: Described here are actions for Mandrake, it will work for other distro's too, but names may be slightly different.
INTRO: These are the 4 steps:
1) use xev for getting the keycodes,
2) make a script mapping the keys,
3) make a new directory in the startmenu for odd actions,
4) use kmenuedit to assign the keys to entries in the startmenu.
1) Open a console and type "xev" ( if nothing comes up, install xev: "urpmi xev" or "urpmi X11R6-contrib" ) xev will open a window, look for the line:
state 0x10, keycode 116 (keysym 0xff20, Multi_key), same_screen YES,
Now press a key and note down the keycode, repeat this for every key you want to assign an action to ( also volume up/down, right and left "windows" key, logitech-key, any key on your board ! )
A total of 22 Multi Media keys can be mapped.
2) Next step is making a text file in the autostart directory of your window manager ( or put the lines in /etc/rc.d/rc.local )
|$ vi /home/bruno/.kde/Autostart/multikeys
( replace "bruno", dot kde )
"i" ( to get vi in insert mode )
This is the text for that file:
|QUOTE (Text @ Script)
xmodmap -e 'keycode 116=F13'
xmodmap -e 'keycode 229=F14'
xmodmap -e 'keycode 236=F15'
xmodmap -e 'keycode 178=F16'
etc. ( you can use F13 - F35 )
< Esc > ( vi back to command mode )
"ZZ" ( save the file and close )
|# chmod 0755 /home/bruno/.kde/Autostart/multikeys
( change permissions for the file )
3) Specialy for actions like volume up/down, mute, reboot etc. we have to make a new section in the startmenu: ( mail and browser are already in the menu )
I made a new directory in "amusement", "toys", called multikeys
The entries made in that directory are:
Volume up ( Title ): "aumix -v+10" ( Command )
Volume down: "aumix -v-10"
Mute: "aumix -v-50"
Fwd: "xmms -f"
Rew: "xmms -r"
Play/pause: "xmms -m -t"
Stop xmms: "xmms -s"
Reboot: "shutdown -r now" ( in MDK 9.1: "reboot" )
Sleep: "xset dpms force standby"
Shutdown: "shutdown -h now" ( in MDK 9.1 "halt" )
Screensaver: "dcop kdesktop KScreensaverIface save"
Lock Screen: "dcop kdesktop KScreensaverIface lock"
( for more commands see "kdocp" )
Now SAVE menudrake !
4) In a console type:
This will bring up a different menu-tool, with in the left pane the entries in the startmenu and down to the right the hotkey assignment.
Simply select the "program" on the left, press: current key "none" and you will get a dialog, press the multi-key you want it associated with, press apply, and you're ready for the fun of your fancy keys. ( Don't forget your mail and browser )
In kmenuedit you can set any key combination to your favorite programs ( Alt+x for xine, Alt+h for home, Alt+g for gimp, etc. Warning: the Ctrl key is already used for many shortcuts, see Control Center --> Look and Feel --> Shortcuts for a complete list. )
TIP: Get your console under an easy key too. After all it is your most used app !!
-- Apr 27 2003 ( Revised Dec 13 2005 ) --