osd-notification
Cross-platform, network-triggerable On-Screen Display notification tool.
- Frameless, animated Qt notification widget (fade in/out, auto-sizing, screen-edge positioning)
- Threaded GNTP/1.0 TCP server and JSON UDP server, size-capped and payload-validated
- Typed, validated, self-healing INI configuration (auto-repairs missing keys, clamps out-of-range values)
NotificationClientlibrary with retry/backoff for sending notifications from other processes- Path-traversal-safe icon resolution (icons must resolve inside an allow-listed directory)
- Production CLI:
osd-notification
Install
pip install osd-notification
#or
pip install -e .[pretty,dotenv]
CLI usage
# Show config file path
osd-notification -c
# Show all config values (secrets masked)
osd-notification -c -s
# Get one value
osd-notification -c notification timeout
# Set one value
osd-notification -c notification timeout 5000
# Local demo notification (no server)
osd-notification -t
# Start GNTP (TCP) + UDP servers, blocks until Ctrl+C
osd-notification --server
# Send a notification to a running server
osd-notification --send --title "Build Successful" --text "All tests passed." --transport udp
Library usage
from osd_notification import NotificationClient
client = NotificationClient(host="127.0.0.1", udp_port=23064)
client.send(title="Build Successful", text="All unit tests passed.", icon="icon.png")
from osd_notification.app import OSDApplication
app = OSDApplication()
app.start_servers()
app.run()
Configuration
Config lives at ~/.osd-notification/osd-notification.ini (Windows: %USERPROFILE%\.osd-notification\osd-notification.ini).
| Section | Key | Default | Notes |
|---|---|---|---|
notification |
position |
center_center |
one of the 9 screen positions |
notification |
opacity |
0.95 |
clamped to [0.05, 1.0] |
notification |
timeout |
3000 |
ms, clamped to [0, 60000] |
notification |
sticky |
False |
overridden per-notification |
notification |
margin |
20 |
px from screen edge |
appearance |
font_family |
Consolas |
|
appearance |
char_size |
64 |
clamped [8, 200] |
appearance |
bg_color |
#1E1E2E |
validated hex color |
appearance |
text_color |
#CDD6F4 |
validated hex color |
appearance |
border_color |
#89B4FA |
validated hex color |
server |
enabled |
False |
auto-starts servers if true |
server |
gntp_port |
23053 |
|
server |
udp_port |
23054 |
|
server |
host |
127.0.0.1 |
|
server |
max_payload_bytes |
65535 |
UDP receive cap |
server |
allowed_icon_dirs |
`` (empty) | os.pathsep-separated; CWD always allowed |
window |
base_width |
240 |
default window width, px |
window |
base_height |
240 |
default window height, px |
window |
min_width |
240 |
floor for text-driven auto-resize |
window |
max_width |
380 |
ceiling for text-driven auto-resize |
window |
text_padding |
40 |
px added to measured subtitle width |
window |
extra_height |
40 |
px added to height when text hits max_width |
window |
icon_max_width |
160 |
default icon scale-to width, px |
window |
icon_max_height |
140 |
default icon scale-to height, px |
Security notes
- Icon references from the network are resolved with
resolve_icon_path, which rejects anything outsideallowed_icon_dirs, non-image extensions, or non-existent files — this closes the path-traversal hole present in a naiveos.path.exists(icon)check. - UDP/TCP payloads are size-capped and run through
NotificationPayloadvalidation (title/text length limits, timeout bounds) before they ever reach the GUI. - Secret-looking config keys (
token,password,client_id,client_secret) are masked in--showoutput.
Development
pip install -e .[dev]
pytest
👤 Author
Metadata
Release files for osd-notification 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| osd_notification-1.0.1.tar.gz | 22.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| osd_notification-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.7 kB
Release files / osd_notification-1.0.1.tar.gz
| Download URL | osd_notification-1.0.1.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae7f6b72944b7a7544135f3dac8fb1b64986d7eeffd288b5d082909b4fdb75ad
|
|
BLAKE2b-256 checksum How to use checksums |
5f3870bc1783b7c7fc3582e5905a63acb00aac7e7faad78fb5646df8cfcb3676
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / osd_notification-1.0.1-py3-none-any.whl
| Download URL | osd_notification-1.0.1-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4ac46c5cc690dd9ad32504823aaa416771bbb374968c23eb7f29eaa7b6ea3ae
|
|
BLAKE2b-256 checksum How to use checksums |
da819f17135e48f2714ee0a462c474d2e4910858e51a9b0a03213297ee4deb5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|