(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?
Reformatted excerpts from Henri Ducrocq''s message of 2009-05-13:> (First of alli: Thanks William for that very gorgeous piece of > software!)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>
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>
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
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: > > > 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. > > > It isn''t :) > > > 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. > > > 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
Hi,>From Marc Hartstein: > Excerpts from Marcus Williams''s message of Thu May 14 04:37:38 -0400 2009: > > 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. > > 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
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
Reformatted excerpts from William Morgan''s message of 2009-05-13:> 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_hitsIn 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>
Reformatted excerpts from Henri Ducrocq''s message of 2009-05-17:> 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.)Is this still the case after you save state with "$"? -- William <wmorgan-sup at masanjin.net>
Excerpts from William Morgan''s message of Mon May 18 19:44:01 +0100 2009:> Reformatted excerpts from Henri Ducrocq''s message of 2009-05-17: > > 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.) > > Is this still the case after you save state with "$"?Oops, I didn''t know about "$"... All is working as expected now, thanks! -- Henri