You are not logged in.

damdam76

Beginner

  • "damdam76" started this thread

Posts: 2

Location: france

  • Send private message

1

Friday, February 3rd 2006, 11:22pm

Volume & Hotkeys

Hi everybody !

Since I've got a multimedia keyboard with special volume keys, I've used xmodmap to assign them a 'name' : XF86RaiseVolume and XF86LowerVolume.
Now it's cool i can control the sound volume, and a nice pannel appears showing me a bargraph that displays how loud this volume is set.
But i'm wondering, is there a way i could set the value that the volume increases or decreases each time i use that keys ?
I'm not sure what i'm asking is clear enough ( sorry i'm french )
What i would like to do is to define a different value so that volume doesn't change 10 percent by 10 percent because that just allows only then levels of volume.

Thank in advance.
damdam.

2

Saturday, February 4th 2006, 11:28am

RE: Volume & Hotkeys

I think it is possible to work around this by makeing a script. That script should then be called when you press the button.

In the script, there should be something like this:

Source code

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
#INCR contains the percentage to increse
INCR=20

VOL="`dcop kmix Mixer0 masterVolume`"
VOL="$((${VOL}+${INCR}))"
if [ "${VOL}" -gt "100" ]; then
  VOL="100"
fi

dcop kmix Mixer0 setMasterVolume ${VOL}
For decresing, you should subtract INCR instead of adding it to VOL. It is also possible to use another calculation. I haven't test it, so there can be errors in it.

damdam76

Beginner

  • "damdam76" started this thread

Posts: 2

Location: france

  • Send private message

3

Saturday, February 4th 2006, 12:18pm

RE: Volume & Hotkeys

Hi mark_t and thanks for your help!

Your script works very well.
What i would like to know now is where or how it is actually set in kde that the key named XF86RaiseVolume handle kmix to set the volume louder.
I haven't done anything to define that and as soon as my keyboard key was correctly named, that feature worked automatically!
So i just imagine there's somethere something that defines that !?
It's not that your script doesn't do what i want, but by this way i don't have the graphical bargraph showing me the volume value.

thanks again
damdam.

4

Saturday, February 4th 2006, 12:36pm

RE: Volume & Hotkeys

I don't know exactly, but maybe in the shortcut settings of KMix. In KMix, you can set the shortcuts for every channel, so if you click with the right button on the icon above a channel, you can click on "Setup shortcuts". Maybe the shortcut is setup'ed there.

I don't know the way how to assign a key to a script on a nice way, I do know a workaround to achieve that. You can add to menu items to your KMenu (you can hide them far away: you don't need to click on them), and after that, you can assign a key to that menu entry in the KDE configuration center.

About the dialog popping up: I don't know how to get that. I wouldn't be surprised if there was another dcop-function which can do that, but I can't find it.