diff --git a/volumeset.sh b/volumeset.sh index cad8d4f..06c278f 100755 --- a/volumeset.sh +++ b/volumeset.sh @@ -3,26 +3,28 @@ # notification to twmn using twmnc step=1 +sink="@DEFAULT_SINK@" if [[ $# -eq 1 ]]; then case $1 in "up") - amixer set Master $step%+ + pactl set-sink-mute $sink false + pactl set-sink-volume $sink +$step% direction='increased to ';; "down") - amixer set Master $step%- + pactl set-sink-volume $sink -$step% direction='decreased to ';; "mute") - amixer set Master toggle;; + pactl set-sink-mute $sink toggle;; *) echo "Invalid option";; esac fi -muted=`amixer get Master | grep "Front Left:" | awk '{print $6}'` -vol=`amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]'` +muted=`pactl list sinks | grep "Mute" | awk '{print $2}'` +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 else twmnc -t 'volume' -c "${direction}${vol}" -d 100