From c7fd7a4470b97785c8efe85ee2b09e2ac553e094 Mon Sep 17 00:00:00 2001 From: ZuxRoy Date: Tue, 16 Jul 2024 18:19:54 +0530 Subject: [PATCH] fixed issue of volume increasing even on mute --- volume.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/volume.sh b/volume.sh index 8da9fd2..2a4fb8c 100755 --- a/volume.sh +++ b/volume.sh @@ -8,16 +8,18 @@ muteicon="/home/zuxroy/.local/share/icons/custom/volume-mute.svg" volhicon="/home/zuxroy/.local/share/icons/custom/volume-high.svg" vollicon="/home/zuxroy/.local/share/icons/custom/volume-low.svg" -if [ $TRIGGER -eq 0 ]; then - if [ $VOLUME -gt 0 ]; then - pactl set-sink-volume @DEFAULT_SINK@ -1% - fi -elif [ $TRIGGER -eq 1 ]; then - if [ $VOLUME -lt 100 ]; then - pactl set-sink-volume @DEFAULT_SINK@ +1% - fi -elif [ $TRIGGER -eq 2 ]; then +if [ $TRIGGER -eq 2 ]; then pactl set-sink-mute @DEFAULT_SINK@ toggle +elif [ $STATE = "no" ]; then + if [ $TRIGGER -eq 0 ]; then + if [ $VOLUME -gt 0 ]; then + pactl set-sink-volume @DEFAULT_SINK@ -1% + fi + elif [ $TRIGGER -eq 1 ]; then + if [ $VOLUME -lt 100 ]; then + pactl set-sink-volume @DEFAULT_SINK@ +1% + fi + fi fi VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -P -o '[0-9]+(?=%)' | cut -d$'\n' -f1)