#!/usr/bin/env bash set -euo pipefail if ! command -v playerctl >/dev/null 2>&1; then echo "n/a" exit 0 fi status="$(playerctl status 2>/dev/null || true)" if [ -z "$status" ]; then echo "off" exit 0 fi artist="$(playerctl metadata artist 2>/dev/null || true)" title="$(playerctl metadata title 2>/dev/null || true)" if [ -n "$artist" ] && [ -n "$title" ]; then text="$artist - $title" elif [ -n "$title" ]; then text="$title" else text="$status" fi case "$status" in Playing) prefix="%{F#98971a}>%{F-}" ;; Paused) prefix="%{F#d79921}=%{F-}" ;; *) prefix="-" ;; esac printf '%s %s\n' "$prefix" "$(printf '%s' "$text" | cut -c 1-32)"