diff --git a/TogglDelegate.py b/TogglDelegate.py index d909e48..83b04a6 100644 --- a/TogglDelegate.py +++ b/TogglDelegate.py @@ -3,6 +3,8 @@ from toggl.TogglPy import Toggl from zei.ZeiDelegate import ZeiDelegate from datetime import datetime, timezone from Mapping import Mapping +from plyer import notification +from os.path import dirname, realpath, join import dateutil.parser import logging @@ -49,12 +51,24 @@ class TogglDelegate(ZeiDelegate): _log.info("Stopping currently running entry") self.toggl.stopTimeEntry(current["id"]) + if pid not in self.projects: + _log.info("Project not found, aborting") + return + _log.info( "Now tracking project %s: %s (%s)", self.projects[pid]["name"], description, ", ".join(tags if tags else []), ) + + notification.notify( + title="Toggl", + message=f"Now tracking project {self.projects[pid]['name']} {description} ({', '.join(tags) if tags else ''})", + app_name="Toggl", + app_icon=join(dirname(realpath(__file__)), "icons/toggl.png"), + timeout=5, + ) if pid == 0: return diff --git a/icons/toggl.png b/icons/toggl.png new file mode 100644 index 0000000..27259a2 Binary files /dev/null and b/icons/toggl.png differ diff --git a/requirements.txt b/requirements.txt index 08c73d8..287c6ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,12 @@ +beautifulsoup4==4.10.0 bluepy==1.3.0 +certifi==2021.10.8 +charset-normalizer==2.0.12 +dbus-python==1.2.18 +idna==3.3 +plyer==2.0.0 python-dateutil==2.8.1 +requests==2.27.1 six==1.15.0 +soupsieve==2.3.1 +urllib3==1.26.9