From 0225688ffd3f925541b724bd89bfaa9e8291343d Mon Sep 17 00:00:00 2001 From: ebignumber Date: Fri, 27 Feb 2026 10:17:10 -0500 Subject: [PATCH 1/3] Add feature for notifications on Linux This commit adds a new argument for notifications and displays them using notify-send when the countdown reaches zero. --- termdown/cli.py | 6 ++++++ termdown/modes.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/termdown/cli.py b/termdown/cli.py index 772bbf1..8ffd06a 100644 --- a/termdown/cli.py +++ b/termdown/cli.py @@ -163,6 +163,12 @@ def wrapper(*args, **kwargs): parser.add_argument( "--no-art", action="store_true", help="Don't use ASCII art for display" ) +parser.add_argument( + "-n", + "--notification", + metavar="NOTIFICATION_TEXT", + help="Sends notification when the countdown stops (Linux only for now)", +) parser.add_argument( "--no-text-magic", action="store_true", diff --git a/termdown/modes.py b/termdown/modes.py index 0aa9ada..1050cee 100644 --- a/termdown/modes.py +++ b/termdown/modes.py @@ -38,6 +38,8 @@ def countdown(ui, args): # If seconds_left is zero or negative, immediately break to handle the # "finished" state. This prevents displaying "0" for an entire second # while waiting for the next tick. + if not args.notification == None: + os.system(f'notify-send "{args.notification}"') break if args.alt_format: From ad1913cb89b98f1f2781d91e5924c10d92a47485 Mon Sep 17 00:00:00 2001 From: ebignumber Date: Fri, 27 Feb 2026 13:10:54 -0500 Subject: [PATCH 2/3] Use desktop-notifier instead of notify-send --- pyproject.toml | 1 + termdown/modes.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1b9c3c0..87238fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ dependencies = [ "Pillow", "python-dateutil", "windows-curses; platform_system == 'Windows'", + "desktop-notifier" ] [project.scripts] diff --git a/termdown/modes.py b/termdown/modes.py index 1050cee..2297ff9 100644 --- a/termdown/modes.py +++ b/termdown/modes.py @@ -1,4 +1,6 @@ import os +import asyncio +from desktop_notifier import DesktopNotifier from curses import beep from datetime import datetime, timedelta, timezone from math import ceil @@ -24,6 +26,9 @@ parse_timestr, ) +async def notify(message): + notifier = DesktopNotifier() + await notifier.send(title="Termdown", message=message) def countdown(ui, args): target_time = parse_timestr(args.timespec) @@ -39,7 +44,7 @@ def countdown(ui, args): # "finished" state. This prevents displaying "0" for an entire second # while waiting for the next tick. if not args.notification == None: - os.system(f'notify-send "{args.notification}"') + asyncio.run(notify(args.notification)) break if args.alt_format: From a0cc762472945f6a8bc214a0bd235a84f33bbb20 Mon Sep 17 00:00:00 2001 From: ebignumber Date: Sat, 28 Feb 2026 10:40:15 -0500 Subject: [PATCH 3/3] Add .gitignore --- .gitignore | 3 +++ termdown/cli.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01b5d8b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.venv +uv.lock +termdown/__pycache__ diff --git a/termdown/cli.py b/termdown/cli.py index 8ffd06a..8744f8c 100644 --- a/termdown/cli.py +++ b/termdown/cli.py @@ -167,7 +167,7 @@ def wrapper(*args, **kwargs): "-n", "--notification", metavar="NOTIFICATION_TEXT", - help="Sends notification when the countdown stops (Linux only for now)", + help="Sends notification when the countdown stops (Not avalible in TTY)", ) parser.add_argument( "--no-text-magic",