Skip to content

Commit

Permalink
fixed issue of volume increasing even on mute
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuxRoy committed Jul 16, 2024
1 parent dc64aaf commit c7fd7a4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c7fd7a4

Please sign in to comment.