Files
dotfiles/bin/notify-on-volume

28 lines
551 B
Bash
Executable File

#! /bin/bash
msgId="991049"
volume=$(pamixer --get-volume)
mute=$(pamixer --get-mute)
player_status=$(playerctl status)
player_title=""
player_artist=""
if [[ "$player_status" == "Playing" ]]; then
player_title=$(playerctl metadata title)
player_artist=$(playerctl metadata artist)
fi
if [[ $volume == 0 || "$mute" == "true" ]]; then
dunstify -a "notify-on-volume" -u low -r "$msgId" "Volume muted"
else
body=""
if [[ "$player_title" != "" ]]; then
body="$player_artist - $player_title"
fi
echo "$volume" >$XDG_RUNTIME_DIR/wob.sock
fi