Looking for mailwatch app

Brian J. Tarricone bjt23 at cornell.edu
Tue Sep 2 22:42:48 CEST 2008


Feel free to file feature requests on bugzilla (separate report per 
request, please).

	-b

Grant Edwards wrote:
> On 2008-09-02, Grant Edwards <grante at visi.com> wrote:
> 
>>> I changed how the icons were loaded to accommodate non-square
>>> icons, and forgot that the new way I was using doesn't support
>>> icons with absolute paths. Should be fixed in svn now, but I
>>> didn't have time to test it extensively.
>> That's what users are for... :)
>>
>> Thanks for the quick response -- I'll give it a try some time
>> tomorrow.
> 
> It's working very nicely now. FWIW, the python program below is
> passed one or more mailwatcher .rc file names on the command
> line. For each of the .rc files, it reads the mailbox name and
> generates corresponding svg icons and sticks the icon paths
> back into the mailwatch .rc files.
> 
> A couple nice-to-have features that I've always wanted (but
> never had) in a mailwatcher:
> 
>  * It would be handy to have a way send the mailwatcher(s) a
>    signal to update.  The sequence of events where this would
>    be useful is:
> 
>     1) The watcher detects new mail and changes the icon.
> 
>     2) Clicking on the icon starts an MUA.
> 
>     3) The user deletes/saves/whatever the new message.
> 
>     4) The user closes the MUA.    
> 
>    Now, for the next 9+ minutes (assuming a 10 minute polling
>    period), the user doesn't know whether there's new mail or
>    not.  The icon shows new mail, but that isn't meaningful
>    until the next polling period.
> 
>    If there was a way to trigger an update when the MUA exits,
>    there wouldn't be that period of uncertainty.
> 
>    Another approach would be for the watcher to clear the
>    new-mail status when the MUA is launched and not poll again
>    until the MUA exits.
>    
> 
>  * It would be cool if the panel containing the mailwatchers
>    could stay hidden when there is no new mail.  Can an
>    auto-hide panel "un-hide" itself based on the state of one
>    of the plugins?  
> 
> I don't know enough about how panels/plugins work to know if
> those features are even remotely feasible or not. What's in SVN
> now has all the features required to nicely replace my old
> solution.  Maybe I'll start reading up on how XFCE panels and
> plugins work...
> 
>    
> ------------------------------------------------------------------------
> #!/usr/bin/python
> import sys,glob,os
> from pysvg import pysvg
> 
> 
> def makeIcon(label,filename,color="black",n=24,iconpath=os.getcwd()):
>     s = pysvg.SVG("",height=1.1*n,width=5*n)
>     s.addElement(pysvg.text(label,0.2*n,0.95*n,style_dict={'font-family':'Ariel','font-size':n, 'fill':color}))
>     path = iconpath+"/"+filename
>     open(path,"w").write(s.getXML())
>     return path
> 
> def getFieldValue(lines,key):
>     for line in lines:
>         if line.startswith(key+"="):
>             return line.split("=")[1].strip()
>         
> def setFieldValue(lines,key,value):
>     i = [line.startswith(key) for line in lines].index(True)
>     lines[i] = "%s=%s\n" % (key,value)
> 
> 
> rcfiles = sys.argv[1:]
>     
> for f in rcfiles:
>     lines = open(f,"r").readlines()
>     mailboxName = getFieldValue(lines,"mailbox_name0")
>     iconFileName = makeIcon(mailboxName,"nomail-%s.svg" % mailboxName, "black")
>     setFieldValue(lines,"normal_icon",iconFileName)
>     iconFileName = makeIcon(mailboxName, "newmail-%s.svg" % mailboxName,"red")
>     setFieldValue(lines,"new_mail_icon",iconFileName)
>     os.rename(f,f+"~")
>     open(f,"w").write(''.join(lines))
> ------------------------------------------------------------------------
> 
> 



More information about the Xfce mailing list