mirror of
https://github.com/Manoj-HV30/i3wm-ubuntu-dotfiles.git
synced 2026-05-16 19:35:23 +00:00
28 lines
595 B
Bash
Executable File
28 lines
595 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
MAXLEN=25
|
|
STATUS=$(playerctl status 2>/dev/null) # playing, paused, stopped
|
|
TITLE=$(playerctl metadata title 2>/dev/null)
|
|
|
|
# Decide emoji based on status
|
|
if [ "$STATUS" = "Playing" ]; then
|
|
EMOJI="▶"
|
|
elif [ "$STATUS" = "Paused" ]; then
|
|
EMOJI="⏸"
|
|
else
|
|
EMOJI="⏹"
|
|
fi
|
|
|
|
# If no song
|
|
if [ -z "$TITLE" ]; then
|
|
echo "🕊️ Chillin'"
|
|
else
|
|
# Truncate if too long
|
|
if [ ${#TITLE} -gt $MAXLEN ]; then
|
|
TITLE="${TITLE:0:MAXLEN}…"
|
|
fi
|
|
# Underline with Polybar formatting and show emoji
|
|
echo "%{+u}%{F#8be9fd}$EMOJI $TITLE%{-u}%{F-}"
|
|
fi
|
|
|