Getting volume keys to work in KDE

Getting volume keys to work in KDE

Meir Kriheli meir at mksoft.co.il
Fri Mar 13 11:34:49 IST 2009


Shachar Shemesh wrote:
> Hi all,
> 

<snippeded>

> Last, we want the KDE startup to make these mappings (which, like I
> said, probably should go into the PC keyboard definition - if anyone has
> the volume keys bound to a different keycode, please shout). Create a
> file called ~/.kde/Autostart/keycodes, which has the following structure:
> 
> #!/bin/sh
> xmodmap -e 'keycode 174=XF86AudioLowerVolume'
> xmodmap -e 'keycode 176=XF86AudioRaiseVolume'
> xmodmap -e 'keycode 160=XF86AudioMute'
> xmodmap -e 'keycode 212=XF86MonBrightnessUp'
> xmodmap -e 'keycode 101=XF86MonBrightnessDown'
> 
> I'm sure you get the idea from here as far as other undefined keys are
> concerned.
> 
> That's it. KDE already has pretty decent default handling of the
> XF86AudioRaiseVolume family of sym codes, so there is nothing further
> you need to do.
> 
> Shachar

Better yet, place them in ~/.Xmodmap which is read upon session startup,
that way it's desktop agnostic (same file works for me in KDE, Gnome and
Xfce). here's my .Xmodmap (for Thinkpad X60s):

$ cat ~/.Xmodmap
keycode 234 = XF86Back
keycode 233 = XF86Forward
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 153 = XF86AudioNext
keycode 144 = XF86AudioPrev
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 160 = XF86AudioMute
keycode 159 = XF86LaunchA


Cheers
--
Meir Kriheli



More information about the Linux-il mailing list