This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Unread email tray notification or plasmoid

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I'm trying to find an "unread email" notifier for either the system tray or the panel. However, I've been unsuccessful. A few of them (mail-notification and gnubiff) don't work in the new Plasma 5 system tray, requiring a separate stand-alone tray (e.g. stalonetray or wmsystemtray). kbiff hasn't been ported to Plasma 5. trysterobiff seems the most promising, but I'm not comfortable leaving my passwords in plaintext (although this might be the only option). Are there any other options?

Last edited by sparhawk on Sun Oct 04, 2015 11:11 pm, edited 1 time in total.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I managed to roll my own using imapnotify and awesome widgets. The former allows you to trigger a script on new mail, using IMAP IDLE. The latter is a plasmoid that allows you to display the text output of a script.

Hence, when there is new mail, imapnotify writes to a temporary file, and awesome widget will show the contents. To make the "notification" disappear, you can script the deletion of this file.

I'm using mutt with maildir, so removing the temporary file is relatively straightforward. When new mail comes in, imapnotify triggers a script which syncs my mailbox, then counts the number of unread emails in ~/.mail/*/Inbox/new . It prints this total to the temporary file, which awesome widget displays. I aliased mutt to run this same script after closing. Hence, if there are no files in ~/.mail/*/Inbox/new, the temporary file is deleted, and awesomewidget displays nothing. It's a bit of a kludge, but it works quite well.

I'm not sure how you could trigger the deletion of this file in a general case. Perhaps imapnotify could trigger a loop that could constantly check the presence of new mail and delete the file if there is none.
thugo
Registered Member
Posts
45
Karma
0
Is there an easier solution available by now?
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
thugo wrote:Is there an easier solution available by now?


I'm still using my hack. I'm relatively happy with it. A bit fiddly to set up, but haven't had to change it for over three years since the previous post. FWIW this is code I'm using.

At ~/.local/bin/get_new_mail_count:
Code: Select all
#!/usr/bin/env bash
# Count the number of files (emails) that are new.

# Skip any that have flag T (trashed) http://cr.yp.to/proto/maildir.html
count=$(find ~/.mail/*/Inbox/new -type f | grep '2,[PRSDF]*T[PRSDF]*' -v | wc -l)
if [[ $count == 0 ]]; then
  echo ''
else
  echo $count
fi

Then use Awesome Widgets to point to this script.
thugo
Registered Member
Posts
45
Karma
0
Thank you sparhawk very much! ... also for sharing your script! ... :-)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]