As I noticed many people were complaining by unmanging use of special multimedia keys of their keyboard under Kubuntu(KDE) I decided to adapt Gnome's how-to version to a short and easy KDE how-to version.
1.Assigning X keysyms
This time you can stay under X X keysyms are a sort of descriptive string like: XF86AudioMedia, XF86WWW etc. but we can't use random names. A list of X keysyms can be found in the file: /usr/share/X11/XKeysymDB
Fire up a terminal and type:
press a multimedia key. If you are lucky it has already a keysym binded to it, so the output of xev for that key will be something like this:
Code:
KeyRelease event, serial 28, synthetic NO, window 0x3200001,
root 0xb7, subw 0x0, time 137010761, (693,138), root:(705,256),
state 0x10, keycode 136 (keysym 0x1008ff27, XF86Forward), same_screen YES,
XLookupString gives 0 bytes:
The third row is the one of interest: it says that you have a keycode for that key (136) as well as keysym (XF86Forward).
If you have a keysym then it's all good, you can use that string to represent your key and use gnome keybindings or metacity keybindings to bind the relevant action to it
In this case you have to assign oyur keysym to the relevant keycode (136) (it doesn't match the kernel keycode for that keys, but it doesn't matter, it's by design).
This is done with xmodmap.
First, create a file with your current X keyboard map, in a terminal type:
Code:
xmodmap -pke > xmodmap.conf
Then you are going to add all the missing keysyms to this file: use xev to see which keycode to use, look in the file /usr/share/X11/XKeysymDB to find keysym names, open the xmodmap.conf file and fill in the missing keysym using a name which makes sense (i.e. if you have a button with a calculator printed on it, use XF86AudioPlay as keysym).
Repeat this passage for all your multimedia keys.
When finished, you can apply the changes with:
Code:
xmodmap xmodmap.conf
Now you want to load your new xmodmap.conf when X starts. I've found that the better way is to put the command in the ~/.kde/Autostart directory in the case of using KDE
Code:
sudo cp xmodmap.conf /etc/xmodmap.conf
echo 'xmodmap /etc/xmodmap.conf' > ~/.kde/Autostart/shortcutkeyset
2.Using KDE khotkeys to bind commands to keys
Open a terminal and type:
Go under Menu Editor entries left panel
- New Action - name it on the right side of panel AudioPlay - choose Action type: Keyboard Shortcut -> Command/URL (simple)
-click Keyboard Shortcut tab- press the (multimedia)key desired to open the audio player( notice that once pressed the key you'll have it displayed with its keysym name: in my example XF86AudioPlay)
- click Command/URL Settings -type a command as: amarok -p (or any other player command with option of play that you want to be triggered by this key).
Apply
...and you are done with just one key..
Repeat step 2 with New Action for all of your special keys that you assinged in step 1..of course defining different commands as you desire.
Note: All above was tested in Breezy version...I didn't want actually open another thread in right spot of forum just because I thought is better this way in keeping the right of author of this how-to.
Hope this post will help you.
Bookmarks