System Volume Control (rfe)
In order to control my system volume, I used to bind my laptop media keys like this:
spawn "command='amixer -q set Master 5%+'; pgrep -f \"^$command$\" || exec $command")
for:
XF86XK_
XF86XK_
which, would unfortunately spawn lots of subshells if I held down the keys:
/bin/sh -c "command='amixer -q set Master 5%+'; pgrep -f \"^$command$\" || exec $command")"
... x100
pgrep -f amixer -q set Master 5%+'
... x100
amixer -q set Master 5%+'
... x100
All these asynchronous backgrounded amixer process would try accessing the volume at once, the result being that even though the volume channels remain locked, the channels go out of sync. So for example, channel 0 of Master would be at "50%" while channel 1 of Master would be at "76%". Annoying.
Now I do:
#!/bin/bash
trap 'adjust_volume 5 -' SIGRTMIN+5
trap 'adjust_volume 5 +' SIGRTMAX-5
function adjust_volume {
if [[ "$run_times" -eq 0 ]]; then
amixer -q set Master "$1%$2"
fi
}
while : ; do
run_times=0
sleep 0.05
done
Which is great, but requires starting a separate service in ~/.xinitrc or whatever rocks your boat.
And then I found panflute, so I thought the two could be combined... as so:
on "org.mpris.
RaiseVolume or RaiseSystemVolume
LowerVolume or LowerSystemVolume
that behave in the same manner as the bash script, that is
"dbus-send --session --print-reply --type=method_call --dest=
Even better, instead of using amixer, this can be accomplished through pyalsaaudio.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Panflute Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask orbisvicis for more information if necessary.