mirror of https://gitlab.com/dabruh/dotfiles.git
30 lines
619 B
Bash
Executable File
30 lines
619 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SINK="@DEFAULT_SINK@"
|
|
LIMIT=150
|
|
ADJUSTMENT=$1
|
|
|
|
function limit_level() {
|
|
level="$(pactl get-sink-volume "$SINK" | grep '^Volume' | cut -d' ' -f5 | grep -o "[[:digit:]]*")"
|
|
|
|
if [[ "$level" -gt "$LIMIT" ]]; then
|
|
echo "Limiting volume to: $1"
|
|
set_level $LIMIT%
|
|
fi
|
|
}
|
|
|
|
function set_level() {
|
|
echo "Desired volume adjustment: $1"
|
|
pactl set-sink-volume "$SINK" "$1"
|
|
}
|
|
|
|
if [[ "$ADJUSTMENT" == set-*-mute ]]; then
|
|
echo "Desired volume adjustment: $1"
|
|
pactl "$ADJUSTMENT" "$SINK" toggle
|
|
else
|
|
set_level "$ADJUSTMENT"
|
|
limit_level $LIMIT
|
|
fi
|
|
|
|
killall -SIGUSR1 i3status
|