Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Ben Gamari <bgamari@gmail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] Libnotify popups with sup
Date: Sun, 17 Jan 2010 13:10:06 -0500	[thread overview]
Message-ID: <1263751749-sup-5625@ben-laptop> (raw)
In-Reply-To: <1263747594-sup-5588@deepthought>

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
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

  reply	other threads:[~2010-01-25 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-17 17:13 Anirudh Sanjeev
2010-01-17 18:10 ` Ben Gamari [this message]
2010-01-17 18:19 ` Cameron Matheson
2010-01-17 18:20 ` Ben Gamari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263751749-sup-5625@ben-laptop \
    --to=bgamari@gmail.com \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox