2010-10-14

Notify git status to Growl/libnotify in background

dev

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
Published at 2010-10-14 23:25:59 +0900 | Permalink