blog.sorah.jp

Notify git status to Growl/libnotify in background

I putted git status in zsh prompt, but sometimes slowly like git-svn ruby repo.

So I found the page notify to Growl, but It needed a drb daemon for notify it.

http://d.hatena.ne.jp/hitode909/20100222/1266808483

Ruby supports fork, I used fork for background working, but fork wake up slowly (slower than prompt putting!)

But we can use spawn for instead.

Spawn

fork: Clone this process

fork { .. }: Clone this process and run block

spawn: Make another process and run in background

zshrc

requirements

  • ruby1.9+
  • notify.gem
  • git.gem
  • libnotify with libnotify-bin or growl

script

Demerits

  • Ruby doesn't know myself; spawned ruby is same as ruby?
  • Doesn't know version; it is really 1.9+?
  • Error will be not hidden; it puts error directly if failed

Backfilled at , Published at