diff --git a/assets/parcel-delivery-icon.txt b/assets/parcel-delivery-icon.txt new file mode 100644 index 0000000..b1244c0 --- /dev/null +++ b/assets/parcel-delivery-icon.txt @@ -0,0 +1,3 @@ +Icon taken from uxwing.com: https://uxwing.com/parcel-delivery-icon/ + +License for the icon: https://uxwing.com/license/ \ No newline at end of file diff --git a/assets/parcel-delivery-icon.webp b/assets/parcel-delivery-icon.webp new file mode 100644 index 0000000..81df2c6 Binary files /dev/null and b/assets/parcel-delivery-icon.webp differ diff --git a/trackbert.py b/trackbert.py index d7eba81..b47a676 100644 --- a/trackbert.py +++ b/trackbert.py @@ -7,6 +7,7 @@ import subprocess import argparse import logging +from pathlib import Path from typing import Tuple, Never # Print date and time and level with message @@ -16,7 +17,7 @@ logging.basicConfig( datefmt="%Y-%m-%d %H:%M:%S", ) -def notify(title: str, message: str): +def notify(title: str, message: str, urgency: str = "normal", timeout: int = 5000): """Send a desktop notification If notify-send is not found, this function will do nothing. @@ -32,9 +33,12 @@ def notify(title: str, message: str): subprocess.run( [ "notify-send", + "-a", "trackbert", + "-u", urgency, + "-t", str(timeout), + "-i", str(Path(__file__).parent / "assets" / "parcel-delivery-icon.webp"), title, message, - # TODO: Look into other options, like adding an icon ] ) @@ -256,9 +260,14 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() + # Shipment creation arguments parser.add_argument("--tracking-number", "-n", type=str, required=False) parser.add_argument("--carrier", "-c", type=str, required=False) parser.add_argument("--description", "-d", type=str, required=False) + + # Notification arguments + + args = parser.parse_args() # If the user specified a tracking number and carrier, create a shipment and exit