Alex Kilgore skrev:
>>> Could you post yor script here please ?
>>>
>>>   
>> Here you go, Ive commented it to explain a little, you may have to edit it 
>> to your needs, hope this helps

Thanks a lot :-)

But it won't work here :-/

I've forgot to tell you that I run offlineimap to collect my mail from gmail
into ~/Mail/INBOX

When I run the script this directory shows in my home:

/etpipe_decode=$my_pipe_decode;unsetmy_pipe_decode

and it contains the 3 dirs in my INBOX. new, cur, tmp

???? Not shure though what causes this :-/


I've made some small changes in your script according to my paths:

#####################################################################
#!/usr/bin/perl

#open file
open(STAT,'/home/niels/.wmii-3.5/mail.status');

#get the contents that the file previously had
$mailprev = <STAT>;

#if "No Mail" is written in the file, set the number of messages to 0
if ($mailprev eq "No Mail")
  {
      $mailprev = 0;
  }

#if the file was blank, set the number of messages to 0
if ($mailprev eq "")
  {
      $mailprev = 0;
  }

# The next line fetches the new message count from the POP3 server
#and filter out the irrelevant parts,
#for me, Fetchmail generated the relevant output :
#either "fetchmail: No Mail for ..." or "fetchmail: X messages for...."
#I used fetchmail for this,
#but you could use any other mail checking application,
#of course you would need to alter that
# so that it fits your needs, it would be very easy to use
# whatever you do to check mail, you could do something
# along the lines of
#
#                  
$mail = `ls -al ~/Mail/INBOX/new |wc -l`."messages";
#
# to get a message count,
#        (I am not too familiar with the maildir format,
#        so if I am wrong about that let me know )

#$mail = `fetchmail -c | sed -e "s/fetchmail\://" |sed -e "s/for.*//"`;

#open file for writing
open(STAT,'>/home/niels/.wmii-3.5/mail.status');

#actually write the formatted output to the file
print STAT "$mail";

#####################################################################

I call the script 'mail' and made it excutable with chmod +x mail.

I've put this in my .wmiirc:

# Status Bar Info
status() {
        echo -n "$(cat '/home/niels/.wmii-3.5/mail')" "$(date +"%T | %A 
%d.%m.%y | Uge %V")"
}


Only effect in the statusbar is that it writes the contents of the file in
one long line :-/

When I run the scripts in a terminal I get this:
No mail for niels

So, the script works :-)

But not in the statusbar !

-- 
/Niels
Registered Linux user #133791
Get counted at http://counter.li.org


Reply via email to