Hello,
I have a openbox install, i search what are the command i must set for down/up/mute the volume with my multimedia key.
Could you help me please?
Hello,
I have a openbox install, i search what are the command i must set for down/up/mute the volume with my multimedia key.
Could you help me please?
My Website : www.atlas95.com !
First, you may need to get your keycodes for these special keys from the xev program that will dump the X events into your terminal screen. So as you do mouse events, and keyboard events, the codes are dumped for you to see.
Use that program to get the key events for your volume keys you want to use. It will dump output something like the following:In this case, you see that the "keycode" is 161Code:KeyPress event, serial 32, synthetic NO, window 0x2000001, root 0x13a, subw 0x0, time 3204054097, (867,651), root:(868,673), state 0x0, keycode 161 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 32, synthetic NO, window 0x2000001, root 0x13a, subw 0x0, time 3204054097, (867,651), root:(868,673), state 0x0, keycode 161 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False
Then (assuming openbox matches fluxbox in this matter) add the events to your keys file that contains your desired keyboard shortcuts.
In that case, for my system, 161 matches the calculator special key, so I have added the following entry to my keys file:You can execute any command line audio commands, such as alsa-mixer or what not.Code:None 161 :Exec xcalc
I am not at my Linux box at the moment (I am on a short break at work), so I cannot be more specific at the moment, but I can check back on this thread later today if you have tried this and still have problems.
Linux Genuine Advantage: I am licensed!
Spouting mindless hatred of all things Microsoft since... ummm... never.
Hi,
thanks for your help, could you help me to find what is the command to launch for set pulse volume, with command such as pacmd, pactl or whatever... I doesn't want to use alsamixer volume
My Website : www.atlas95.com !
Thanks but isn't the method to bind my multimedia keyboard that i search, but what is the command to attribute to set the PULSEAUDIO volume kpkeerthi
My Website : www.atlas95.com !
Unfortunately, you have caught me at work again.
I can see pulseaudio documentation here: http://www.pulseaudio.org/wiki/CLI
But I can see an absolute setting, and not a +5% type of adjust that I am used to in alsa.
I haven't looked at keytouch, except to follow kpkeerthi's link, and not sure I would agree that an outside app would be better than using the native *box support.
(p.s. I see that Openbox uses a different keybinding system than fluxbox, so my example earlier will not apply, and you must use the openbox xml file that you are probably already familiar with)
Linux Genuine Advantage: I am licensed!
Spouting mindless hatred of all things Microsoft since... ummm... never.
I managed to increase/decrease the volume of my pulseaudio with the following scripts.
Maybe they'll be of some use for other people:
vol+
vol-Code:#!/bin/bash A=`pacmd dump | grep "set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo" | cut -d " " -f 3` B=$((A + 0x01000)) if [ $(($B)) -gt $((0x10000)) ] then B=$((0x10000)) fi pactl set-sink-volume 0 `printf "0x%X" $B`
muteCode:#!/bin/bash A=`pacmd dump | grep "set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo" | cut -d " " -f 3` B=$((A - 0x01000)) if [ $(($B)) -lt $((0x00000)) ] then B=$((0x00000)) fi pactl set-sink-volume 0 `printf "0x%X" $B`
Code:#!/bin/bash A=`pacmd dump | grep "set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo" | cut -d " " -f 3` if [ $A = "no" ] then pactl set-sink-mute 0 yes else pactl set-sink-mute 0 no fi
The above scripts didn't work for me; they set the volume to a absolute levels instead of raising/lowering it.
The following zsh one-liners work great:
Volume up:
Volume down:Code:pacmd set-sink-volume 0 $(printf '0x%x' $(( $(pacmd dump|grep set-sink-volume|cut -f3 -d' ') + 0xf00)) )
Mute:Code:pacmd set-sink-volume 0 $(printf '0x%x' $(( $(pacmd dump|grep set-sink-volume|cut -f3 -d' ') - 0xf00)) )
Working well in my .awesomerc with zsh -c in front, should work fine in openbox configs as well.Code:pacmd set-sink-mute 0 $(if [ $(pacmd dump |grep set-sink-mute | cut -f 3 -d' ') = 'no' ]; then echo yes; else echo no; fi;)
Another script. Universal, based on AWK:
Volume up:
Volume down:Code:pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3+1000)}'
Mute:Code:pacmd dump|awk --non-decimal-data '$1~/set-sink-volume/{system ("pacmd "$1" "$2" "$3-1000)}'
Code:pacmd dump|awk --non-decimal-data '$1~/set-sink-mute/{system ("pacmd "$1" "$2" "($3=="yes"?"no":"yes"))}'
Extending those one-liners, adding the ability to jump larger increments and avoiding wrapping the volume to something huge when reducing (ouch!):
Create two links to that script, named pa_vol_up and pa_vol_down, then they can be run without parameters to step up/down by 1% or with a single parameter to make that the step. E.g.;Code:#!/bin/bash [[ $0 == pa_vol_down ]] && _down=true [[ $1 ]] && let _vol_increment=$1*655 || _vol_increment=655 _full_line=`pacmd dump|grep "set-sink-volume"` _sink_cmd=`echo $_full_line|cut -d" " -f1` _sink_id=`echo $_full_line|cut -d" " -f2` _sink_vol=`echo $_full_line|cut -d" " -f3` [[ $_down ]] && let _vol=$_sink_vol-$_vol_increment || let _vol=$_sink_vol+$_vol_increment [[ $_vol -lt 0 ]] && _vol=0 [[ $_vol -gt 65536 ]] && _vol=65536 pacmd $_sink_cmd $_sink_id $_vol > /dev/null
pa_vol_up 10
pa_vol_down 15
I'm sure there's an elegant way to extract the 3 elements of the dump and manipulate them, but I'm a bear of very little brain, so I've done my best.
Bookmarks