Created
November 22, 2009 04:43
-
-
Save ohac/240427 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'ruby-growl' | |
require 'socket' | |
u = UDPSocket.new | |
u.bind('localhost', 9887) | |
loop do | |
msg, inetaddr = u.recvfrom(1500) | |
gnn = msg.unpack(Growl::GNN_FORMAT) | |
next if gnn.shift != 1 # version | |
next if gnn.shift != 1 # type | |
flags = gnn.shift # 0x000e -> priority, 0x0001 -> stiky | |
str = gnn.pop | |
pt = 0 | |
ls = (gnn + [ 16 ]).map{|l| str[pt, l].tap{pt += l}} | |
name, title, desc, app, md5 = ls | |
`notify-send '#{title}' '#{desc}'` # TODO not secure | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment