diff options
Diffstat (limited to 'notmuch/.local/lib')
-rwxr-xr-x | notmuch/.local/lib/notmuch/notmuch-notify | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/notmuch/.local/lib/notmuch/notmuch-notify b/notmuch/.local/lib/notmuch/notmuch-notify index bc93f09..b8a38b6 100755 --- a/notmuch/.local/lib/notmuch/notmuch-notify +++ b/notmuch/.local/lib/notmuch/notmuch-notify @@ -18,25 +18,30 @@ def notify(title, message): ) -# Workaround for bug in the notmuch module's default config resolution -if os.environ.get("NOTMUCH_CONFIG") is None: - os.environ["NOTMUCH_CONFIG"] = os.path.join( - os.environ.get( - "XDG_CONFIG_HOME", os.path.join(os.path.expanduser("~"), ".config") - ), - "notmuch", - os.environ.get("NOTMUCH_PROFILE", "default"), - "config", - ) +def main(): + # Workaround for bug in the notmuch module's default config resolution + if os.environ.get("NOTMUCH_CONFIG") is None: + os.environ["NOTMUCH_CONFIG"] = os.path.join( + os.environ.get( + "XDG_CONFIG_HOME", os.path.join(os.path.expanduser("~"), ".config") + ), + "notmuch", + os.environ.get("NOTMUCH_PROFILE", "default"), + "config", + ) -for message in ( - notmuch.Database( - mode=notmuch.Database.MODE.READ_WRITE, - ) - .create_query("tag:notify") - .search_messages() -): - print(message) - message.remove_tag("notify") - notify(message.get_header("From"), message.get_header("Subject")) - del message + for message in ( + notmuch.Database( + mode=notmuch.Database.MODE.READ_WRITE, + ) + .create_query("tag:notify") + .search_messages() + ): + print(message) + message.remove_tag("notify") + notify(message.get_header("From"), message.get_header("Subject")) + del message + + +if __name__ == "__main__": + main() |