Created
September 29, 2016 09:51
-
-
Save mrngm/7cd2a2ca2eb99523806a056cd5e96267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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