dotfiles/.local/bin/volume-notify
2026-08-15 19:39:06 +01:00

24 lines
565 B
Bash
Executable file

#!/usr/bin/env bash
# AUTHOR: Daesorin
# CREATED: 2026-08-04 05:01 +0100
set -euo pipefail
if [ "$1" = "toggle" ]; then
pamixer -t
elif [[ "$1" == +* ]]; then
val="${1#+}"
pamixer -i "${val%\%}"
elif [[ "$1" == -* ]]; then
val="${1#-}"
pamixer -d "${val%\%}"
fi
volume=$(pamixer --get-volume)
muted=$(pamixer --get-mute)
if [ "$muted" = "true" ]; then
notify-send -h string:x-canonical-private-synchronous:volume -u low "Volume: Muted"
else
notify-send -h string:x-canonical-private-synchronous:volume -u low "Volume: ${volume}%"
fi