2020-11-29 03:47:19 +01:00
|
|
|
#!/bin/bash
|
2020-11-20 21:33:51 +01:00
|
|
|
|
|
|
|
class=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
|
|
|
|
icon=""
|
2020-11-29 03:47:19 +01:00
|
|
|
limit=50
|
2020-11-20 21:33:51 +01:00
|
|
|
|
|
|
|
if [[ $class == "playing" ]]; then
|
|
|
|
info=$(playerctl metadata --player=spotify --format '{{artist}} {{album}} - {{title}}' | sed 's/"//g')
|
2020-11-29 03:47:19 +01:00
|
|
|
if [[ ${#info} -gt $limit ]]; then
|
|
|
|
info=$(echo $info | cut -c1-$limit)"..."
|
2020-11-20 21:33:51 +01:00
|
|
|
fi
|
|
|
|
text=$icon" "$info
|
|
|
|
elif [[ $class == "paused" ]]; then
|
|
|
|
text=$icon
|
|
|
|
elif [[ $class == "stopped" ]]; then
|
|
|
|
text=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
|