Created
April 9, 2024 04:43
-
-
Save ForeverZer0/9b9b3b2775ea931b6b95a2b16e9f1d6a to your computer and use it in GitHub Desktop.
Simple script to display dunst notifications with title, artist, and album art when the current song changes in MPD.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Simple script to display display a notification when the current song changes | |
# in MPD, showing the title, artist, and cover/album art. | |
# | |
# Requires: dunst, mpd, and mpc | |
ALBUMART="/tmp/albumart" | |
TIMEOUT=3000 | |
song=$(mpc current --format "%file%") | |
while true | |
do | |
current=$(mpc current --format "%file%") | |
if [ "$song" != "$current" ]; then | |
song="$current" | |
mpc albumart "$song" > $ALBUMART | |
title=$(mpc current --format "%title%") | |
artist=$(mpc current --format "%artist%") | |
dunstify -a mpd-notify -u 0 -I "$ALBUMART" -t $TIMEOUT -h "string:x-dunst-stack-tag:mpd-notify" "$title" "$artist" | |
fi | |
mpc idle player > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment