nix-config/pkgs/change-audio/change-audio

24 lines
477 B
Plaintext
Raw Normal View History

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"
newVolume="$(pamixer --get-volume || true)"
[ "$(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" \
-- "$MSG"