show playerctl info in volume notifications
This commit is contained in:
@@ -5,10 +5,23 @@ msgId="991049"
|
|||||||
volume=$(pamixer --get-volume)
|
volume=$(pamixer --get-volume)
|
||||||
mute=$(pamixer --get-mute)
|
mute=$(pamixer --get-mute)
|
||||||
|
|
||||||
if [[ $volume == 0 || "$mute" == "true" ]]; then
|
player_status=$(playerctl status)
|
||||||
# Show the sound muted notification
|
|
||||||
dunstify -a "notify-on-volume" -u low -r "$msgId" "Volume muted"
|
player_title=""
|
||||||
else
|
player_artist=""
|
||||||
# Show the volume notification
|
|
||||||
dunstify -a "notify-on-volume" -u low -r "$msgId" -h int:value:"$volume" "Volume: ${volume}%"
|
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
|
||||||
|
|
||||||
|
dunstify -a "notify-on-volume" -u low -r "$msgId" -h int:value:"$volume" "Volume: ${volume}%" "$body"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user