suckless-utils/scripts/eww/eww-album

31 lines
759 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
# Display currently playing music metadata.
if status="$(playerctl "$@" status 2>&1)" && [ "$status" != "Stopped" ]; then
[ "$status" = "Paused" ] && icon="$pausedIcon"
playerctl="$(playerctl "$@" metadata --format "{{album}}" | sed 's/\(.\{25\}\).*/\1.../')"
else
[ "$(mpc status "%state%")" = "paused" ] && icon="$pausedIcon"
mpd="$(mpc current -f "%album%" | sed 's/\(.\{25\}\).*/\1.../')"
fi
if [ -z "$(mpc current -f "%album%")" ]; then
currentSong="Let's go party!"
else
currentSong="$mpd"
fi
if [ "$status" = "No players found" ]; then
if [ -z "$mpd" ]; then
currentSong="Let's go party!"
else
currentSong="$mpd"
fi
else
currentSong="$playerctl"
fi
[ -z "currentSong" ] && exit
echo "$currentSong"