Skip to content

Instantly share code, notes, and snippets.

@mrngm
Created September 29, 2016 09:51
Show Gist options
  • Save mrngm/7cd2a2ca2eb99523806a056cd5e96267 to your computer and use it in GitHub Desktop.
Save mrngm/7cd2a2ca2eb99523806a056cd5e96267 to your computer and use it in GitHub Desktop.
#!/bin/bash
i3status | while :
do
read line
playerstatus=`playerctl status`
artist=`playerctl metadata artist`
title=`playerctl metadata title`
np=""
if [[ "$playerstatus" == "Playing" ]]; then
np="|> ${artist} - ${title}"
fi
if [[ "$playerstatus" == "Paused" ]]; then
np="|| ${artist} - ${title}"
fi
if [[ "$np"x == "x" ]]; then
echo ${line} || exit 2
else
if [[ ${line:0:2} == ",[" ]]; then
echo ${line} | sed -e "s/^,\[/,\[{\"name\":\"spotify\",\"markup\":\"none\",\"full_text\":\"${np}\"},/"
else
echo ${line}
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment