nixos-config/scripts/playerctl-status
2023-02-08 17:12:54 -03:00

15 lines
299 B
Bash

#!/bin/sh
PLAYERCTL="playerctl --ignore-player=mpd"
STATUS="$(env LC_ALL=C $PLAYERCTL status title)"
TITLE="$($PLAYERCTL metadata title)"
ARTIST="$($PLAYERCTL metadata artist)"
test "$STATUS" = "Playing" \
&& printf " %s" "$TITLE" \
&& test -n "$ARTIST" \
&& printf " - %s" "$ARTIST"
echo ""