suckless-utils/scripts/eww/eww-music

31 lines
771 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 "{{title}}" | sed 's/\(.\{25\}\).*/\1.../')"
else
[ "$(mpc status "%state%")" = "paused" ] && icon="$pausedIcon"
mpd="$(mpc current -f "%title%" | sed 's/\(.\{25\}\).*/\1.../')"
fi
if [ -z "$(mpc current -f "%title%")" ]; then
currentSong="Nothing is playing :/"
else
currentSong="$mpd"
fi
if [ "$status" = "No players found" ]; then
if [ -z "$mpd" ]; then
currentSong="Nothing is playing :/"
else
currentSong="$mpd"
fi
else
currentSong="$playerctl"
fi
[ -z "currentSong" ] && exit
echo "$currentSong"