From 507a466269fcbdaa354b5fa6b6b6b84bd89624dd Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 6 Dec 2022 23:51:38 +0200 Subject: Add spotify/media script to show/control what's currently playing --- .config/polybar/scripts/get_spotify_status.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.config/polybar/scripts') diff --git a/.config/polybar/scripts/get_spotify_status.sh b/.config/polybar/scripts/get_spotify_status.sh index e4ec716..0666ba7 100755 --- a/.config/polybar/scripts/get_spotify_status.sh +++ b/.config/polybar/scripts/get_spotify_status.sh @@ -14,7 +14,7 @@ PLAYER="spotify" # Format of the information displayed # Eg. {{ artist }} - {{ album }} - {{ title }} # See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata -FORMAT="{{ title }} - {{ artist }}" +FORMAT="{{ title }} - {{ artist }}" # Sends $2 as message to all polybar PIDs that are part of $1 update_hooks() { @@ -24,11 +24,11 @@ update_hooks() { done < <(echo "$1") } -PLAYERCTL_STATUS=$(dbus-send --player=$PLAYER status 2>/dev/null) +PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ]; then - STATUS=$dbus-send_STATUS + STATUS=$PLAYERCTL_STATUS else STATUS="No player is running" fi @@ -40,11 +40,11 @@ else echo "No music is playing" elif [ "$STATUS" = "Paused" ]; then update_hooks "$PARENT_BAR_PID" 2 - dbus-send --player=$PLAYER metadata --format "$FORMAT" + playerctl --player=$PLAYER metadata --format "$FORMAT" elif [ "$STATUS" = "No player is running" ]; then echo "$STATUS" else update_hooks "$PARENT_BAR_PID" 1 - dbus-send --player=$PLAYER metadata --format "$FORMAT" + playerctl --player=$PLAYER metadata --format "$FORMAT" fi fi -- cgit v1.2.3