tested with vlc, rhythmn box.
thanks from reddit.
/waybar/bin/playerinfo
cd Down
#!/bin/sh
# Get list of active players
players=$(playerctl -l)
# Check if any player is active
if [ -n "$players" ]; then
# Iterate through each player
for player in $players; do
# Get player's status
status=$(playerctl -p "$player" status 2>/dev/null)
# Check if player is playing
if [ "$status" = "Playing" ]; then
# Get metadata for the player
metadata=$(playerctl -p "$player" metadata --format {{'title'}} 2>/dev/null)
if [ -n "$metadata" ]; then
# Print filtered metadata
echo "$player":"$metadata" | sed -E 's/[[:space:]]+/-/g'
else
echo "No artist or title found for $player"
fi
fi
done
#if a player is paused or w/e still displayed on playerctl -l
echo "No audio player is active"
else
#all other isntances
echo "No audio player is active"
fi