Excerpts from Anirudh Sanjeev's message of Sun Jan 17 12:13:12 -0500 2010:
> Hi,
> 
> I want to write a small hook to sup to use libnotify and show a small
> popup whenever email comes from specific sources.
> 
You mean something like this? It was a little flaky when I last used it,
but it did work.

- Ben


# libnotify notifications
# Requires libnotify-bin package
notify_cmd = "/usr/bin/notify-send -i 
/usr/share/icons/Human?/scalable/emblems/emblem-mail.svg"
if num >= 1
        notify_summary = "sup found #{num_inbox}/#{num} new message"
        notify_summary << "s" if num > 1
        notify_body = ""

        from_and_subj.each do |f,s|
                f.gsub! /\(.*\)/, ''
                f.gsub! /<.*>/, ''
                f.strip!
                s.slice! 0..20
                s << "..."
                notify_body << "▶ #{f} : #{s}\n"
        end
        if notify_body.length > 100
                notify_body.slice! 0..100
                notify_body << "\n..."
        end

        cmd = "#{notify_cmd} '#{notify_summary}' '#{notify_body}'"
        Logger.warn cmd
        system cmd
else
        #system "#{notify_cmd} 'sup status' 'No new email (yet)'"
end
_______________________________________________
sup-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to