Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 12-16-2008, 02:17 PM   #1
El Nigromante
Registered: Aug 2008
Distribution: Slackware 12.2, Slackware 13.0
Posts: 40

Rep: Reputation: 17
Configure multimedia keys in Slackware 12.2 and KDE


Surely most of you know how to set up the special or "multimedia" keys in some keyboards. There are also many pages in the Internet explaining the process. However, to save you all that google-ing, I explain here the steps (I found this thread quite useful

1) First of all, the kernel must map the scan code from the key to a known key code.

In some cases that mapping is already done. In other cases it is not. In order to know this, you can run a "tail -f /var/log/syslog" command as root, and press the target key(s). If you see something like this:

Dec 16 17:36:58 sanson kernel: atkbd.c: Unknown key pressed (translated set 2, code 0xa6 on isa0060/serio0).
Dec 16 17:36:58 sanson kernel: atkbd.c: Use 'setkeycodes e026 <keycode>' to make it known.
Dec 16 17:36:58 sanson kernel: atkbd.c: Unknown key released (translated set 2, code 0xa6 on isa0060/serio0).
Dec 16 17:36:58 sanson kernel: atkbd.c: Use 'setkeycodes e026 <keycode>' to make it known.
then you have to map that key in the kernel using the "setkeycodes" command (as reported by the kernel in the messages above). You should make an init script with all the required mappings, so they are loaded each time your computer boots, like this one:

# /etc/rc.d/rc.localkeys
# Set special keys in the kernel.
# Refer to /usr/include/linux/input.h for the appropriate keycode values.


setkeycodes e015 $KEY_HOMEPAGE
setkeycodes e023 $KEY_WWW
setkeycodes e06e $KEY_CALC
setkeycodes e026 $KEY_HELP
You can have a look at the "input.h" header and use the "standard" key code values for your keys, according to their intended functions.

Then, make your /etc/rc.d/rc.localkeys executable and put something like this in /etc/rc.d/rc.local:

# /etc/rc.d/rc.local:  Local system initialization script.
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

if [ -x /etc/rc.d/rc.localkeys ]; then
2) You now should map the X key codes to the corresponding key symbols.

X key codes are not the same than kernel key codes (I have not found the correspondence between both groups of values yet ). The best way to know the X key code for any given key is running the "xev" program from X (in an X console), then pressing the target key, and taking note of the key code it logs. For an example:

KeyRelease event, serial 34, synthetic NO, window 0x1600001,
    root 0x13b, subw 0x0, time 2355334, (656,465), root:(660,490),
    state 0x0, keycode 174 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
Here I pressed the "lower volume" key (I have it already mapped to the "XF86AudioLowerVolume"), which has an X key code value = "174".

Taking note of those values, you should now make an /etc/X11/xinit/.Xmodmap file, like this one:

! /etc/X11/xinit/.Xmodmap
! Set special keys in Xorg
! Refer to /usr/share/X11/XKeysymDB for the appropriate symbols.

keycode 178 = XF86HomePage
keycode 130 = XF86WWW
keycode 236 = XF86Mail
keycode 161 = XF86Calculator
keycode 245 = XF86LightBulb
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 160 = XF86AudioMute
keycode 223 = XF86Sleep
This file will be passed as an argument to /usr/bin/xmodmap each time you log into your X session, so all those keys are mapped to their corresponding symbols. As stated in the comment, you can look the /usr/share/X11/XKeysymDB file to know the X symbols suitable for your keys' functions.

3) The last step is setting up your configured keys in KDE.

You can do it globally, in KDE Control Center -> Regional & Accessibility -> Input Actions (or also in Keyboard shortcuts), and you can also do it per application, in the settings menu.

That's all

Last edited by El Nigromante; 12-16-2008 at 02:21 PM.
Old 12-16-2008, 07:16 PM   #2
Senior Member
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,366

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
I haven't tried this yet, but it looks as though a few buttons I couldn't see in xev produce output in /var/log/syslog, and I should be able to map them using your guide. I didn't really look into this, but I was (mildly) annoyed that I couldn't get keycodes for those keys. Thanks a lot!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multimedia Keys r1d3r Linux - Laptop and Netbook 3 12-19-2008 10:12 PM
Getting multimedia keys working in FC9 KDE 4.1 dwmorton Linux - Laptop and Netbook 2 09-18-2008 09:01 PM
configure kde shortcut keys in fc5 jon23d Fedora 2 06-07-2006 03:36 AM
Multimedia keys killerbob Slackware 2 05-20-2005 09:21 PM
Multimedia Keys in KDE 3.2 GameboyHippo Linux - Software 2 12-15-2003 01:41 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration