diff --git a/wallabag-add.py b/wallabag-add.py index b153c07..b63f178 100755 --- a/wallabag-add.py +++ b/wallabag-add.py @@ -4,6 +4,7 @@ import json import logging import os import sys +from subprocess import PIPE, Popen from typing import List import requests @@ -190,9 +191,26 @@ def add_url(config, url): # TODO: check auth error handling return None, r.status_code == 401 + send_notification(url) return r.json(), False +def send_notification(url): + """Send a notification to the user using dunstify.""" + try: + Popen( + [ + "dunstify", + "-i", + "~/.local/share//icons//wallabag.svg", + "wallabag-add.py:", + "Added {}".format(url), + ] + ) + except Exception: + logger.error("Error while sending notification", exc_info=True) + + if __name__ == "__main__": sysargs = sys.argv urls = sysargs[1:]