27 lines
458 B
Bash
Executable File
27 lines
458 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SINK='@DEFAULT_SINK@'
|
|
CUR="$(pactl get-sink-volume "$SINK" | awk '$1 == "Volume:" {print substr($5, 1, length($5) - 1)}')"
|
|
CUR="$((CUR - CUR % "$1"))"
|
|
|
|
case "${1:0:1}" in
|
|
'')
|
|
exit 1
|
|
;;
|
|
'+'|'-')
|
|
NEW="$((CUR + "$1"))"
|
|
;;
|
|
*)
|
|
NEW="$1"
|
|
;;
|
|
esac
|
|
|
|
[ "$NEW" -lt 0 ] && NEW=0
|
|
[ "$NEW" -gt 100 ] && NEW=100
|
|
|
|
pactl set-sink-volume "$SINK" "$NEW%"
|
|
pactl set-sink-mute "$SINK" 0
|
|
|
|
echo "$NEW"
|