Fire notifications when new emails appear in your offline mailboxes. Needs a notification service such as
dunst to be usable.
Should be POSIX compliant and work in most shells (tested in
Copy or symlink all sh scripts to
bin directory of your choice (names must be kept the same).
When using the systemd unit file, the choice of
bin directory matters. See section Systemd unit for further instructions.
mailnotify [OPTION]... [DIR_TO_WATCH] Options: -e, --exclude-dir Directory to exclude from watching. Mail files created in this directory will not trigger a notification. May be applied multiple times for multiple directories.
Directory that should be watched for new emails may hold multiple email accounts. Specify one additional argument per subdirectory that should be excluded, e.g. for
[Gmail]/Sent Items etc.
mailnotify \ -e Trash \ -e Sent \ -e 'Read Later' \ -e '[Gmail]/Sent Items' \ ~/.local/share/mail
To run mailnotify as a systemd service, the executable
mailnotify-run is used. This script is a wrapper for mailnotify and should be run it with the desired options.
First create a shell script named
mailnotify-run. The unit file's
ExecStart expects the script to sit at
~/.local/bin/mailnotify-run, so change the path accordingly if necessary. Also, if the path to the binaries is not in the unit file's
Environment option, the path must be added there as well.
Copy or symlink
~/.config/systemd/user/ and run
systemctl --user enable mailnotify.service && systemctl --user start mailnotify.service.
Ideas and/or PRs to address these limitations are always welcome.