Skip to content

Instantly share code, notes, and snippets.

@retospect
Created June 20, 2014 17:04
Show Gist options
  • Save retospect/ae2a2aa9e599536abe3d to your computer and use it in GitHub Desktop.
Save retospect/ae2a2aa9e599536abe3d to your computer and use it in GitHub Desktop.
Print pianobar song and artist in tab name on osx
# ~/.config/pianobar/config
user = user@example.com
password = very_secret
event_command = /Users/username/.config/pianobar/tabname.sh
#!/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