# volume on-screen-display for multimedia keys not working

## bluesurfer

Hi,

i have a HP Compaq nc8430 Notebook with Gentoo installed.

I followed this howto to get my multimedia keys working:

http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys

I created an Xmodmap file under my home directory which i load

at KDE startup.

The keys work, i can lower, higher or mute the volume with the keys in KDE.

The problem is the on-screen-display of kmix doesn't show up when

I change the volume.

I remember it did show up some time ago, but I didn't change anything

in the config. Perhaps it was caused by an software update.

Can anyone help me please?

----------

## baeksu

I believe the OSD is provided by the package 'kmilo'.

----------

## bluesurfer

yes that's true, but kmilo should be already included in kdeutils.

----------

## blakedude

I just got this working by doing the xmodmap change mentioned in the above MultiMedia Keys HOWTO.  It worked for me, and I get a big progress bar display of the volume change and a Mute/Unmute message with the mute button.

I do not have kmilo installed, so it must be some other part of KDE that shows the volume up/down/mute message.

----------

## bluesurfer

 *blakedude wrote:*   

> I just got this working by doing the xmodmap change mentioned in the above MultiMedia Keys HOWTO.  It worked for me, and I get a big progress bar display of the volume change and a Mute/Unmute message with the mute button.
> 
> I do not have kmilo installed, so it must be some other part of KDE that shows the volume up/down/mute message.

 

So how do you load the xmodmap file at kde startup?

----------

## blakedude

 *Quote:*   

> So how do you load the xmodmap file at kde startup?

 

I put it in my .bash_profile.  This may not be correct, but it does load the keymap.  You can also just manually type 'xmodmap .xmodmaprc'

```
#$HOME/.bash_profile snippet

if [ -z "$XMODDEFINED" ] && [ "$DISPLAY" ]

then

  xmodmap .xmodmaprc

  export XMODDEFINED yes

fi

```

.xmodmaprc is the file that contains the commands to map the buttons to Xorg functions:

```

!$HOME/.xmodmaprc

keycode 160 = XF86AudioMute

keycode 144 = XF86AudioPrev

keycode 153 = XF86AudioNext

keycode 176 = XF86AudioRaiseVolume

keycode 174 = XF86AudioLowerVolume

```

Blake

----------

## bluesurfer

thanks blakedude.

I tried your method, but still no luck for me.

It's still the same, I can use the buttons in KDE, but I

don't have a OSD   :Sad: 

----------

## blakedude

 *Quote:*   

> thanks blakedude. 
> 
> I tried your method, but still no luck for me. 
> 
> It's still the same, I can use the buttons in KDE, but I 
> ...

 

The OSD is put up there by KMilo.  That is a KDE service that is part of the kdeutils package, or it can be installed separately.

To turn it on, go to the KDE Control Center (kcontrol), and under "KDE Components", look at "Service Manager".  Then in the "Startup Services" box, make sure KMilo is running.  On my laptop, I can turn the OSD on and off by starting and stopping KMilo.

There may be USE flags that play into this, but this is a start.

Blake

----------

## bluesurfer

I think I solved the problem now.

I set the multimedia keys as shortcuts in kmix.

If I remove these shortcuts, the keys still work fine AND I see the OSD.

No idea why this happens.

Anyway, thanks a lot for your help blakedude!

----------

## freifunk_connewitz

just for anybody who has a similar problem and did not found the solution in the postings above:

i run into it after switching from monolithic to split KDE ebuilds. the multimedia keys did not work any more. so i configured kmix in the "configure global shortcuts" menu to use them and so i got them working again, but without the OSD. 

to get that working again as well i had to follow these exact steps:

- switch the global shortcuts in kmix back to defaults (that is: no global shortcuts)

- go to the service manager of the KDE control center as described above

- switch kmilo off and on again -> the multimedia keys for volume control work again AND the OSD, too.

reason? maybe its some small problem with the emerge order of kmix and kmilo? i don't know...

----------

## ljubo

Thanks! Works lika a charm!

This thread should be marked as [SOLVED].

Regards, Ljubo

----------

## overkll

Isn't there a default location one can place .xmodmaprc or xmodmaprc or even xmodmap so that it is run by default for all users? The man page for xmodmap doesn't mention any default file locations.

According to /etc/X11/xinit/xinitrc, xinitrc will check first for xmodmap file in /etc/X11/Xmodmap, then $HOME/.Xmodmap.  I'm running xdm to start kde, and neither of these work.  Removing xdm from the default runlevel and executing "startx" _DOES_ work.  The xmodmap file is found and executed with xmodmap.

So it seems xdm/kdm doesn't use /etc/X11/xinit/xinitrc?  How does one replicate the startx/xinitrc behavior when using xdm/kdm? 

Digging through /usr/kde/3.5/bin/startkde reveals that any script located in /etc/X11/xinit/xinitrc.d/ will be executed as system defaults.  Currently on my setup, there is only 30-dbus.  So if one adds an executable script that calls "xmodmap </path/to/Xmodmap>" to that dir, the keys are set correctly when kde starts and function correctly with OSD.  YEAH!

So, I put Xmodmap in /etc/X11/ and made a simple script called Xmodmap, and chmod'd it to 755

Contents of /etc/X11/xinit/xinitrc.d/Xmodmap:

```
xmodmap /etc/X11/Xmodmap
```

This way, it will work with both xdm/kdm AND startx.

Is there another "keycode" that would operate the wlan button/led?

----------

## F-0_ICE

two questions: one i got the key and the osd working but is there a way to decrease the volume increase per key press? eg if my volume is at 0 it goes to 12% then 25% and then 38% and +13% so on till 100%. how can i set it to lets say +5% instead of 13%?

two: no a biggie but the osd has a gray background. can it be transparent?

TIA

----------

## overkll

FO Ice,

Yes, you should be able to adjust the steping of the volume.  I do remember seeing an option somewhere via the KDE Control Center.  Unfortunately, I can't tell you exactly where to find it since a) i don't use KDE and b) the laptop I was working on was a customer's.

----------

## F-0_ICE

i found what your talking about in the admin section of kcontrol for IBM thinkpad but it is grayed out. i am trying to use the osd for my desktop if it means anything.

----------

