changed volume to use pactl
This commit is contained in:
+8
-6
@@ -3,26 +3,28 @@
|
|||||||
# notification to twmn using twmnc
|
# notification to twmn using twmnc
|
||||||
|
|
||||||
step=1
|
step=1
|
||||||
|
sink="@DEFAULT_SINK@"
|
||||||
|
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
case $1 in
|
case $1 in
|
||||||
"up")
|
"up")
|
||||||
amixer set Master $step%+
|
pactl set-sink-mute $sink false
|
||||||
|
pactl set-sink-volume $sink +$step%
|
||||||
direction='increased to ';;
|
direction='increased to ';;
|
||||||
"down")
|
"down")
|
||||||
amixer set Master $step%-
|
pactl set-sink-volume $sink -$step%
|
||||||
direction='decreased to ';;
|
direction='decreased to ';;
|
||||||
"mute")
|
"mute")
|
||||||
amixer set Master toggle;;
|
pactl set-sink-mute $sink toggle;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid option";;
|
echo "Invalid option";;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
muted=`amixer get Master | grep "Front Left:" | awk '{print $6}'`
|
muted=`pactl list sinks | grep "Mute" | awk '{print $2}'`
|
||||||
vol=`amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]'`
|
vol=`pactl list sinks | grep "front-left" | awk '{print $5}'`
|
||||||
|
|
||||||
if [[ $muted == "[off]" ]]; then
|
if [[ $muted == "no" ]]; then
|
||||||
twmnc -t 'volume' -c 'muted' -d 100
|
twmnc -t 'volume' -c 'muted' -d 100
|
||||||
else
|
else
|
||||||
twmnc -t 'volume' -c "${direction}${vol}" -d 100
|
twmnc -t 'volume' -c "${direction}${vol}" -d 100
|
||||||
|
|||||||
Reference in New Issue
Block a user