2021-11-04 15:56:01 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ "$1" = "up" ]; then
|
|
|
|
upDown="-i"
|
|
|
|
else
|
|
|
|
upDown="-d"
|
|
|
|
fi
|
|
|
|
|
|
|
|
pamixer --allow-boost "$upDown" "$2"
|
2021-11-12 09:40:37 +01:00
|
|
|
newVolume="$(pamixer --get-volume || true)"
|
2021-11-12 09:49:00 +01:00
|
|
|
[ "$(pamixer --get-volume-human)" = "muted" ] && isMuted=true
|
|
|
|
|
|
|
|
MSG="Set volume to $newVolume%"
|
|
|
|
if [ "${isMuted:-false}" = true ]; then
|
|
|
|
MSG="$MSG (muted)"
|
|
|
|
fi
|
2021-11-04 15:56:01 +01:00
|
|
|
|
|
|
|
notify-send -u low \
|
|
|
|
-h string:x-canonical-private-synchronous:change-audio \
|
|
|
|
-h "int:value:$newVolume" \
|
2021-11-12 09:49:00 +01:00
|
|
|
-- "$MSG"
|