diff options
author | davidpkj <davidpenkow1@gmail.com> | 2024-04-17 18:35:12 +0200 |
---|---|---|
committer | davidpkj <davidpenkow1@gmail.com> | 2024-04-17 18:35:12 +0200 |
commit | 15b131da12cf4975307d4f7618a1f2902a1a9dc9 (patch) | |
tree | daf6cfab9bcfb3b79840fede465b585432537926 /scripts/.local/bin/personal/volctl | |
parent | 5b9f5d92c4b6961049179598a235db60bed6ecbf (diff) |
potato update
Diffstat (limited to 'scripts/.local/bin/personal/volctl')
-rwxr-xr-x | scripts/.local/bin/personal/volctl | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/scripts/.local/bin/personal/volctl b/scripts/.local/bin/personal/volctl index 0a3625f..628449e 100755 --- a/scripts/.local/bin/personal/volctl +++ b/scripts/.local/bin/personal/volctl @@ -2,22 +2,26 @@ # A script to manage the volume on my system universally -sink="$(pactl list short sinks | grep "pci-0000_00_1b.0" | awk '{print $1}')" +sink="$(pactl list short sinks | grep "pci-0000_00_1f.3" | awk '{print $1}')" volume="$(pamixer --get-volume)" +last_volume=45 -if [ "$1" = "increase" ] -then +if [ "$1" = "increase" ]; then pactl set-sink-volume "$sink" +5% -elif [ "$1" = "decrease" ] -then + volctl save +elif [ "$1" = "decrease" ]; then pactl set-sink-volume "$sink" -5% -elif [ "$1" = "mute" ] -then - # TODO: Make this a toggle with memory - pactl set-sink-volume "$sink" 0% -elif [ "$1" = "check" ] -then + volctl save +elif [ "$1" = "mute" ]; then + if [ "$volume" = "0" ]; then + pactl set-sink-volume "$sink" "$last_volume%" + else + pactl set-sink-volume "$sink" 0% + fi +elif [ "$1" = "save" ]; then + sed -i "s/last_volume=45$last_volume/last_volume=45$volume/g" "$0" +elif [ "$1" = "check" ]; then printf "%s\n" "$volume" -else +else printf "[ Error ] Not enough arguments.\n" fi |