2023-05-17 00:21:45 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-09-07 23:50:02 -04:00
|
|
|
class=$(playerctl metadata --format '{{lc(status)}}')
|
2023-09-08 20:50:02 -04:00
|
|
|
icon=""
|
2023-05-17 00:21:45 -04:00
|
|
|
|
|
|
|
if [[ $class == "playing" ]]; then
|
2023-09-07 23:50:02 -04:00
|
|
|
info=$(playerctl metadata --format '{{artist}} - {{title}}')
|
2023-05-17 00:21:45 -04:00
|
|
|
if [[ ${#info} > 40 ]]; then
|
2023-09-07 23:50:02 -04:00
|
|
|
info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..."
|
2023-05-17 00:21:45 -04:00
|
|
|
fi
|
|
|
|
text=$info" "$icon
|
|
|
|
elif [[ $class == "paused" ]]; then
|
|
|
|
text=$icon
|
|
|
|
elif [[ $class == "stopped" ]]; then
|
|
|
|
text=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
|
|
|
|
|