Parse if there have been new mails synched to the local dir.

Profpatsch mail at profpatsch.de
Thu Jan 31 01:03:11 GMT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/30/2013 10:21 AM, Tomasz Żok wrote:
> Depending on the number of emails you have and the type of drive
> (SSD? big cache?), the 'find' command may execute faster or slower.
> But inotify is AFAIK a special mechanism for notifications of
> filesystem events suited just for this purpose. A program/script
> informs kernel that it wants to be inotified and it will wait
> without any further I/O or CPU usage until the filesystem event 
> occurs.

But: You need a (bash-)script running an infinite loop to check for
changes and reacting to it by modifying the file saving the mail count.
I don’t know how much unnecessary clutter
    while :
    do
        check_for_new_status_messages_from_pipe()
    done
creates.
Atm I have a bash script running find (which normally is cached for
some time) on the specified accounts in the maildir (I don’t want the
count of my spam account to show) every time offlineimap is run,
writing to a file which then is read by my status bar every five seconds.

Here are the files for people who are interested:

https://github.com/Profpatsch/dotfiles/blob/master/.offlineimap/run_offlineimap.sh
Parsing into i3bar:
Without colors:
https://github.com/Profpatsch/dotfiles/blob/master/.i3/i3status_mailwrapper.sh
With colors:
https://github.com/Profpatsch/dotfiles/blob/master/.i3/i3status_mailwrapper.py
For .sh: Call script from within .i3/config.
For .py: Add “order += mail” to your i3status.config and in your
.i3/config, call i3status --config <i3config> |
~/.i3/i3status_mailwrapper.py

I hope this is understandable. If not, all files are in the various
files on github.
Any thoughts on the scripts?

~Profpatsch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRCcLOAAoJEMXP0IsiJHzfysgP+wfSNit1nD4ygntSZI2bdf48
m2QnSzC4rSvv80ITGKCgUAW+/n0IsULDm+f3JiYHYVqgDse5RdvK7iggfjLm4XH5
C1bCTP5qOxEN++4E4TE9SycXMEIY6/z6GGKAIfuMCzy9iOzUMVBN5m+VlmtV4nBU
JIHy5R2GgXN37u00MtK1ajN78fKFHZsR+M8AAx7MA5oN1NXiOM9CMnkfX6FI1rPO
ZKoHjdgIUknV7cnr7L4KR4eSifLvnyhn7nnP08P6CQG3aKkqgfDqjpvgPfmm4/NS
ZnFhhZ9c351QDQUW8+DKcLLL2e0b7xNY1BcKc0TeudEJbQTyW42jdrPL+aHMJcLZ
Hg0+D5dEQwnmcDubpYwdVdDU6D6nQNtFJAuUgxbWqbG9T2Yy74M3q5q2Z/UGtba5
aY2McFeqwUYvnrnJ+sgz6z2JitRGAaZHjY2VP82gMZz7k7lMNM0Qi6LNFDqCpMa8
nex5etGzVWeQIgpgTwtO0e0oJ21Bo6WBkfcFERk5eIGMk2TAbZmauhShzK37U0iX
mFgBAmfhZEAgDCRor4wJfLsqih8lnukZvalOmkx73GIxJmmwJyZk2bTaWvR/2MxQ
NcbGE/r9iFrqfKzndTqriivnWmLV8yJ6wjNwtf3mQroU9iebxASRqWkOm2mJgSUP
Kn754lJFbVgG9+3aU0FI
=rOY6
-----END PGP SIGNATURE-----




More information about the OfflineIMAP-project mailing list