Skip to content

Instantly share code, notes, and snippets.

@mrkgrandjean
Created December 18, 2015 18:13
Show Gist options
  • Save mrkgrandjean/c5f8ea18ef798668ccc3 to your computer and use it in GitHub Desktop.
Save mrkgrandjean/c5f8ea18ef798668ccc3 to your computer and use it in GitHub Desktop.
A simple way to make your pianobar, send you mac OsX notifications. It puts the Cover Art as the app Icon, and clicking on the notification skips that song. All files are placed in ~/.config/pianobar/, you also need to run gem install terminal-notifier, and put a blank file called ctl in the ~/.config/pianobar/ folder
user = user@email.com
password = s3cr3t
fifo = ~/.config/pianobar/ctl
event_command = ~/.config/pianobar/notifier.rb
#!/usr/bin/env ruby
trigger = ARGV.shift
if trigger == 'songstart'
# Get current song information
songinfo = {}
STDIN.each_line { |line| songinfo.store(*line.chomp.split('=', 2)) }
`terminal-notifier -title "Pianobar: Now Playing" -message "#{songinfo['title']}\nby #{songinfo['artist']}" -appIcon "#{songinfo['coverArt']}" -execute "echo 'n' > ~/.config/pianobar/ctl"`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment