Created
June 20, 2014 17:04
-
-
Save retospect/ae2a2aa9e599536abe3d to your computer and use it in GitHub Desktop.
Print pianobar song and artist in tab name on osx
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
# ~/.config/pianobar/config | |
user = [email protected] | |
password = very_secret | |
event_command = /Users/username/.config/pianobar/tabname.sh | |
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 | |
# ~/.config/pianobar/tabname.sh | |
function tabname { | |
printf "\e]1;$1\a" | |
} | |
fold="$HOME/.config/pianobar" | |
ctlf="$fold/ctl" | |
nowplaying="$fold/lyrics.sh" | |
while read L; do | |
k="`echo "$L" | cut -d '=' -f 1`" | |
v="`echo "$L" | cut -d '=' -f 2`" | |
export "$k=$v" | |
done < <(grep -e '^\(title\|artist\|album\|stationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|songDuration\|songPlayed\|coverArt\|stationCount\|station[0-9]\+\)=' /dev/stdin) | |
case "$1" in | |
songstart) | |
tabname "P: $title by $artist" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment