diff options
| author | srdusr <trevorgray@srdusr.com> | 2022-12-06 23:51:38 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2022-12-06 23:51:38 +0200 |
| commit | 507a466269fcbdaa354b5fa6b6b6b84bd89624dd (patch) | |
| tree | 4a1f1cd1333d2acc82073da9ef3663969760c892 | |
| parent | e9537349dea1a36ed0a2633ca5cf71a8cc8999b6 (diff) | |
| download | dotfiles-507a466269fcbdaa354b5fa6b6b6b84bd89624dd.tar.gz dotfiles-507a466269fcbdaa354b5fa6b6b6b84bd89624dd.zip | |
Add spotify/media script to show/control what's currently playing
| -rwxr-xr-x | .config/polybar/scripts/get_spotify_status.sh | 10 |
1 files changed, 5 insertions, 5 deletions
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 |
