2023-11-11 13:00:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
class=$(playerctl metadata --player=firefox --format '{{lc(status)}}')
|
|
|
|
icon=" "
|
|
|
|
|
|
|
|
if [[ $class == "playing" ]]; then
|
|
|
|
info=$(playerctl metadata --player=firefox --format '{{title}}')
|
2023-11-28 07:34:18 +00:00
|
|
|
if [[ ${#info} > 40 ]]; then
|
|
|
|
info=$(echo $info | cut -c1-40)"..."
|
2023-11-11 13:00:22 +00:00
|
|
|
fi
|
|
|
|
text=$info" "$icon
|
|
|
|
elif [[ $class == "paused" ]]; then
|
|
|
|
text=$icon
|
|
|
|
elif [[ $class == "stopped" ]]; then
|
|
|
|
text=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
classa=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
|
|
|
|
|
|
|
|
if [[ $classa == "playing" ]]; then
|
2024-06-14 22:31:23 +00:00
|
|
|
icon=" "
|
2023-11-11 13:00:22 +00:00
|
|
|
info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
|
2023-11-28 07:34:18 +00:00
|
|
|
if [[ ${#info} > 40 ]]; then
|
|
|
|
info=$(echo $info | cut -c1-40)"..."
|
2023-11-11 13:00:22 +00:00
|
|
|
fi
|
|
|
|
text=$info" "$icon
|
|
|
|
elif [[ $class == "paused" ]]; then
|
|
|
|
text=$icon
|
|
|
|
elif [[ $class == "stopped" ]]; then
|
|
|
|
text=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
|