You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
498 B
31 lines
498 B
#!/usr/bin/sh |
|
|
|
|
|
COMMAND="playerctl --player=$BLOCK_INSTANCE" |
|
|
|
case $BLOCK_BUTTON in |
|
1) $COMMAND previous ;; |
|
3) $COMMAND next ;; |
|
esac |
|
|
|
|
|
if [ "$($COMMAND status)" = "Playing" ]; then |
|
colour="#00FF00" |
|
else |
|
colour="#FF8000" |
|
fi |
|
|
|
title=$($COMMAND metadata title | sed "s/\&/\&/g") |
|
artist=$($COMMAND metadata artist | sed "s/\&/\&/g") |
|
|
|
if [ "$title" != "(null)" ]; then |
|
ret="<span foreground='$colour'>$title</span>" |
|
if [ -n "$artist" ]; then |
|
ret="$ret - $artist" |
|
fi |
|
|
|
echo "$ret"; |
|
fi |
|
|
|
|
|
|
|
|