* [sup-talk] Notification tools
@ 2009-05-13 11:37 Henri Ducrocq
2009-05-13 18:54 ` William Morgan
0 siblings, 1 reply; 11+ messages in thread
From: Henri Ducrocq @ 2009-05-13 11:37 UTC (permalink / raw)
(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?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
2009-05-13 11:37 [sup-talk] Notification tools Henri Ducrocq
@ 2009-05-13 18:54 ` William Morgan
[not found] ` <391beaa80905131723k4b59090bi5bd541d97d1a75f2@mail.gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: William Morgan @ 2009-05-13 18:54 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
[not found] ` <1242261120-sup-2999@cabinet>
@ 2009-05-14 1:52 ` William Morgan
[not found] ` <1242273707-sup-1213@cabinet>
2009-05-18 18:31 ` William Morgan
0 siblings, 2 replies; 11+ messages in thread
From: William Morgan @ 2009-05-14 1:52 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
[not found] ` <1242273707-sup-1213@cabinet>
@ 2009-05-14 8:37 ` Marcus Williams
[not found] ` <1242331711-sup-4976@cabinet>
0 siblings, 1 reply; 11+ messages in thread
From: Marcus Williams @ 2009-05-14 8:37 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
[not found] ` <391beaa80905131723k4b59090bi5bd541d97d1a75f2@mail.gmail.com>
[not found] ` <1242261120-sup-2999@cabinet>
@ 2009-05-14 13:04 ` Nicolas Pouillard
1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Pouillard @ 2009-05-14 13:04 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
[not found] ` <1242331711-sup-4976@cabinet>
@ 2009-05-15 12:41 ` David Guibert
2009-05-17 19:23 ` Henri Ducrocq
0 siblings, 1 reply; 11+ messages in thread
From: David Guibert @ 2009-05-15 12:41 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
2009-05-15 12:41 ` David Guibert
@ 2009-05-17 19:23 ` Henri Ducrocq
2009-05-18 18:44 ` William Morgan
0 siblings, 1 reply; 11+ messages in thread
From: Henri Ducrocq @ 2009-05-17 19:23 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
2009-05-14 1:52 ` William Morgan
[not found] ` <1242273707-sup-1213@cabinet>
@ 2009-05-18 18:31 ` William Morgan
1 sibling, 0 replies; 11+ messages in thread
From: William Morgan @ 2009-05-18 18:31 UTC (permalink / raw)
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_hits
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>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
2009-05-17 19:23 ` Henri Ducrocq
@ 2009-05-18 18:44 ` William Morgan
2009-05-18 20:03 ` Henri Ducrocq
0 siblings, 1 reply; 11+ messages in thread
From: William Morgan @ 2009-05-18 18:44 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
2009-05-18 18:44 ` William Morgan
@ 2009-05-18 20:03 ` Henri Ducrocq
0 siblings, 0 replies; 11+ messages in thread
From: Henri Ducrocq @ 2009-05-18 20:03 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [sup-talk] Notification tools
@ 2009-05-15 21:22 Henri Ducrocq
0 siblings, 0 replies; 11+ messages in thread
From: Henri Ducrocq @ 2009-05-15 21:22 UTC (permalink / raw)
Excerpts from Nicolas Pouillard's message of Thu May 14 14:04:44 +0100 2009:
> I have a status-bar-text hook.
...
> Then I have tweaked my xmonad config to inject the contents of this
> file in my dzen bar.
But isn't status-bar-text only triggered by keystrokes?
Anyways, I'm updating the file from after-poll.rb, it seems to work.
Henri
(oops, Nicolas you're gonna receive this email twice)
--
--
Henri
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-05-18 20:03 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 11:37 [sup-talk] Notification tools Henri Ducrocq
2009-05-13 18:54 ` William Morgan
[not found] ` <391beaa80905131723k4b59090bi5bd541d97d1a75f2@mail.gmail.com>
[not found] ` <1242261120-sup-2999@cabinet>
2009-05-14 1:52 ` William Morgan
[not found] ` <1242273707-sup-1213@cabinet>
2009-05-14 8:37 ` Marcus Williams
[not found] ` <1242331711-sup-4976@cabinet>
2009-05-15 12:41 ` David Guibert
2009-05-17 19:23 ` Henri Ducrocq
2009-05-18 18:44 ` William Morgan
2009-05-18 20:03 ` Henri Ducrocq
2009-05-18 18:31 ` William Morgan
2009-05-14 13:04 ` Nicolas Pouillard
2009-05-15 21:22 Henri Ducrocq
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox