Subject: [sup-talk] Notification tools

From: [email-masked] (Henri Ducrocq)
Date: Wed, 13 May 2009 12:37:04 +0100

(First of alli: Thanks William for that very gorgeous piece of software!)

I would like to use mail-notification (or an equivalent) to display the status of
my inbox in my system tray, I mean the number of unread emails.
But of course that program isn't aware of what messages have been read inside sup.

What can I do to fix this? I thought about having the after-poll hook dump all new
messages into a dummy mbox file, which would be monitored by mail-notification..
But there must be a simpler way?

---

From: [email-masked] (William Morgan)
Date: Wed, 13 May 2009 11:54:53 -0700

> (First of alli: Thanks William for that very gorgeous piece of

Glad you find it useful!

> I would like to use mail-notification (or an equivalent) to display
> the status of my inbox in my system tray, I mean the number of unread
> emails.  But of course that program isn't aware of what messages have
> been read inside sup.

Sounds great. I'd love to have that too.

> What can I do to fix this? I thought about having the after-poll hook
> dump all new messages into a dummy mbox file, which would be monitored
> by mail-notification..  But there must be a simpler way?

Having now read the mail-notification manpage... the problem is
mail-notification. It should provide a way for other apps to signal a
notification (the whole Unix philosophy of decomposability, etc.) but it
does not.

Periodically dumping all new messages into a dummy mbox file is a
terrible idea, but I think that's your only Sup-specific option.
Patching mail-notification is a better idea, though that may not be what
you want to hear.

If you're using a recent Gnome, you have some other options. If you're
running notification-daemon (e.g. Ubuntu 9.04), you can install the
libnotify-bin package and having the after-poll hook call notify-bin on
new email. (Not quite the same.) You can also look at the
indicator-applet: libindicate also has Python bindings, so you could
install python-indicate and write a python short program to use that.
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (William Morgan)
Date: Wed, 13 May 2009 18:52:14 -0700

Reformatted excerpts from Marc Hartstein's message of 2009-05-13:
> Has anybody done anything like this?  Any code snippets?

I really need to clean up the code so that all of Sup's special query
parsing (chronic, contact aliases, etc.) is accessible, but you can do
simple queries directly through the Ferret API with a script like:

  require 'sup'
  i = Redwood::Index.new
  i.load
  puts "total unread: " + i.ferret.search("label:unread").total_hits
  puts "inbox unread: " + i.ferret.search("label:unread AND label:inbox").total_hits

That gets you the number of messages, not the number of threads. (Sup
doesn't store the latter.)
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Marcus Williams)
Date: Thu, 14 May 2009 09:37:38 +0100

On 14.5.2009, Marc Hartstein wrote:
> Although, I just tried this (I seem to have had to append .to_s to each
> of the total_hits), and it works, but all my results are exactly 15
> greater than the relevant numbers I see if I go into the label menu with
> <L><Enter>.  Any idea what might cause that?

I think the Sup version will by default not include killed or deleted
messages so that might be whats causing it.

Marcus

---

From: [email-masked] (Nicolas Pouillard)
Date: Thu, 14 May 2009 15:04:44 +0200

Excerpts from Henri Ducrocq's message of Thu May 14 02:23:00 +0200 2009:
> On Wed, May 13, 2009 at 7:54 PM, William Morgan <wmorgan-sup at masanjin.net>wrote:
> 
> It isn't :)
> I don't use Gnome or KDE (or anything really.)
> Re. the notification-daemon tip, that's what I'm doing already (via a python
> script of mine, I didn't know about notify-bin!), but sure it isn't the
> same.
> What I might do: Have after-poll dump the number of unread messages into a
> file,
> and display that value in my dzen status bar. It might be good enough.

I'm doing something quite similar:

I have a status-bar-text hook.

$ cat ~/.sup/hooks/status-bar-text.rb
dir = ENV['HOME']+'/.sup/'
state_new = dir+'state.new'
File.open(state_new, 'w') do |f|
  f.puts "SupState { sup_num_inbox_unread = #{num_inbox_unread} }"
end
File.rename(state_new, dir+'state') rescue nil
nil

Then I have tweaked my xmonad config to inject the contents of this
file in my dzen bar.

Best regards,

-- 
Nicolas Pouillard

---

From: [email-masked] (David Guibert)
Date: Fri, 15 May 2009 14:41:33 +0200

Hi,

>From Marc Hartstein:
> Excerpts from Marcus Williams's message of Thu May 14 04:37:38 -0400 2009:
> Deleted Unread messages accounted for 5 of the 15, but there are no
> Killed, so the remaining 10 are still a mystery.

Spam.

I changed sup-biff to contain:

#!/bin/bash

ruby -I '~/src/sup/lib' <<EOF
require 'sup'
i = Redwood::Index.new
i.load

puts "total  spam +            unread: " + i.ferret.search("label:unread").total_hits.to_s
puts "total !spam + !deleted + unread: " + i.ferret.search("!label:spam !label:deleted +label:unread").total_hits.to_s
puts "inbox                    unread: " + i.ferret.search("!label:spam !label:deleted +label:inbox +label:unread").total_hits.to_s
puts "inbox total:  " + i.ferret.search("!label:spam !label:deleted +label:inbox").total_hits.to_s
EOF

regards.
-- 
David

---

From: [email-masked] (Henri Ducrocq)
Date: Sun, 17 May 2009 20:23:41 +0100

I'm having a related problem, but this one is totally internal to Sup:
After I read a new email, in most cases (possibly always, I can't say)
the number of unread emails isn't decremented and stays at 1.
I am talking about the number of unread messages shown on the labels
page ('L' shortcut.)

This is fixed by restarting Sup.

I'm using the gem version of Sup, do I need to switch to the development
branch?

-- 
Henri

---

From: [email-masked] (William Morgan)
Date: Mon, 18 May 2009 11:31:35 -0700

>   puts "inbox unread: " + i.ferret.search("label:unread AND

In the parser-user-query-fix branch (merged into next), you can now use
Index.run_query, which takes a query and returns an array of doc ids.
So you can now do this:

  require 'sup'
  i = Redwood::Index.new
  i.load
  puts "total unread: " + i.run_query("label:unread").size.to_s
  puts "inbox unread: " + i.run_query("label:unread AND label:inbox").size.to_s

which has the same effect as above, but now you should be able to pass
in all the fancy options you can use on the search line (from:/to: with
contacts, :limit, date options if you have chronic installed, etc).
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (William Morgan)
Date: Mon, 18 May 2009 11:44:01 -0700

Reformatted excerpts from Henri Ducrocq's message of 2009-05-17:
> the number of unread emails isn't decremented and stays at 1.  I am
> talking about the number of unread messages shown on the labels page
> ('L' shortcut.)

Is this still the case after you save state with "$"?
-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Henri Ducrocq)
Date: Mon, 18 May 2009 21:03:55 +0100

> Is this still the case after you save state with "$"?

Oops, I didn't know about "$"...
All is working as expected now, thanks!

-- 
Henri