Skip to content

Instantly share code, notes, and snippets.

@hamptonmoore
Created August 12, 2020 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamptonmoore/5061e307d9f9c472b61307ef48896d81 to your computer and use it in GitHub Desktop.
Save hamptonmoore/5061e307d9f9c472b61307ef48896d81 to your computer and use it in GitHub Desktop.
#!/bin/bash
METADATA=$(playerctl metadata --format "{{ title }} - {{ artist }}" 2>&1)
if [ "$METADATA" = "No player could handle this command" ]; then
echo ""
else # Can be configured to output differently when player is paused
polybar-msg -p "$(pgrep -f "polybar top")" hook spotify-play-pause 1 >/dev/null
echo "$METADATA"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment