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