Free Software by Sam Clippinger -- New Mail widget

Author: Sam Clippinger <samc (at) lookandfeel (dot) com>
Copyright: ©2004 lookandfeel new media
License: GNU GPL
Current version: 2.0.0 Archived versions: All versions Documentation: Change Log
Dependencies: None.

Source language: Javascript 1.2
Target platform: Konfabulator 1.7 or better on Mac OS X.
Description: New Mail is a very small widget to notify the user when new mail has arrived. Originally, it was written to work only with Thunderbird/Mozilla but it has since evolved and will now show notify the user of new mail in Apple's Mail application.

Since Thunderbird does not support AppleScript (yet), this widget continually checks the filesystem and watches for any of the files to increase in size. When that happens, new mail is assumed to have arrived. The widget then changes its message to show the name of the file that increased in size. Since Thunderbird/Mozilla stores the mail messages in files named after the folders they represent, the widget shows the name of the Thunderbird folder that contains the new message(s). If your mail isn't automatically sorted into folders by message filters, this widget may not be very useful for you, since it will always say you have new mail in "Inbox".

To configure New Mail to monitor Thunderbird/Mozilla mailboxes, open the widget preferences and set "Top Mail Folder" to the folder that contains your mail files. Usually, that folder is "~/Mail" but you can check by going to "Account Settings" under the "Tools" menu in Thunderbird. Find your mail account in the left side of the dialog and highlight "Server Settings". The directory listed in "Local Directory" is where your mail is stored.

The widget can also be configured to ignore file "endings". This means that any file for which the last part of its name matches one of the given "endings" will be ignored. For example, suppose the following "endings" are given:

Trash, Drafts, Templates, .sdf, .dat, .html, .msf, bar/Inbox
Any files named "Trash", "Drafts" and "Templates" in any directory will be ignored, as will any file with the extensions ".sdf", ".dat", ".html" and ".msf". However, a file named "Document Templates" would also be ignored, because it ends in "Templates". Directory names can also be part of the "ending", so a file named "/foo/bar/Inbox" would be ignored, as would a file named "foobar/Inbox".

To disable New Mail's filesystem checks (e.g. if you don't use Thunderbird), open the widget preferences and set "Top Mail Folder" to no value (blank).

When new mail arrives in Thunderbird/Mozilla and the widget shows the name(s) of the folder(s) that contain the message(s), it will continue to display the folder names until you click on the widget to clear it. This is unfortunate but there is no way for the widget to tell if you have read the mail yet.

When the widget checks Apple's Mail mailboxes, it uses AppleScript and has access to a much greater range of information than when checking the filesystem. When it notifies you of new mail, it can display either the folder in which the message arrived or it can display the name of the sender. This choice can be set in the widget preferences. If you have multiple messages in the same folder or from the same sender, New Mail will indicate the total number after the name in its notification message.

When new mail arrives in Apple's Mail mailboxes and the widget shows the names(s) of the folders(s) or sender(s), you have two choices of ways to clear the notification. You may click on the widget, which clears it completely, or you may mark the mail "read" in the Mail application. New Mail will notice that the message is no longer "unread" and remove it from the notification.

When checking Apple's Mail mailboxes, whole folders will be ignored if their names appear in the "File endings and folders to ignore" list. Unlike when ignoring files in the filesystem (described above), any folder whose _whole_ name matches an entry in the list will be ignored.

To disable New Mail's checks of Apple's Mail mailboxes (e.g. if you don't use Apple's Mail), open the widget preferences and set "Check Apple's Mail mailboxes?" to "Do not check Apple's Mail mailboxes".

If you use New Mail to check both Apple's Mail mailboxes and your filesystem, there is a chance it could notice changes to a folder in each location with the same name. When this happens, New Mail will show the exact count of messages in Apple's Mail mailboxes and a plus ("+") to indicate there is at least one message waiting in Thunderbird/Mozilla. For example, if two messages arrived in Apple's Mail Mailboxes and at least one message arrived in Thunderbird/Mozilla, New Mail might display:

New mail: Inbox:2+

This project is mirrored from