Files
2026-01-01 14:48:20 +01:00

26 lines
844 B
Bash
Executable File

#!/bin/sh
class=$(playerctl metadata --player=Deezer --format '{{lc(status)}}')
icon=""
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=Deezer --format '{{title}} - {{artist}}')
info=$(echo ${info//\"/\\\"}) # Escape quote with \"
if [[ ${#info} -ge 33 ]]; then
info=$(playerctl metadata --player=Deezer --format '{{title}}')
info=$(echo ${info//\"/\\\"}) # Escape quote with \"
fi
if [[ ${#info} -ge 38 ]]; then
info=$(echo $info | cut -c1-35)"..."
fi
tooltip=$(playerctl metadata --format "{{duration(position)}}/{{duration(mpris:length)}}")
text=$info" "$icon
tooltip="🜁 "$tooltip" 🜃"
elif [[ $class == "paused" ]]; then
text="󰏤 "$icon
elif [[ $class == "stopped" ]]; then
text=""
fi
echo -e "{\"text\":\""$text"\", \"tooltip\":\""$tooltip"\"}, \"class\":\""$class"\"}"