Skip to content

Instantly share code, notes, and snippets.

@rawsh
Last active April 11, 2023 05:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rawsh/82bbe36bd61b659513cfc3e84ded658a to your computer and use it in GitHub Desktop.
Save rawsh/82bbe36bd61b659513cfc3e84ded658a to your computer and use it in GitHub Desktop.
Print out the currently playing spotify song. Great with tint2
{ echo "$(spotify-now -i " <b>%title" -e "" -p " paused" | awk -v len=40 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }' | tr -d '&' | awk '{print $0 "</b>"}')"; echo "$(spotify-now -i '%artist' -p ' ' -e ' ')"; } | tr "\n" " "
{ echo "$(playerctl metadata title | awk -v len=40 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }' | tr -d '&' | awk '{print " <b>" $0 "</b>"}')"; echo "$(playerctl metadata artist)"; } | tr "\n" " "

Tint2 example:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment