Skip to main content

DBus Notification

PyPI Python versions License

This library provides a simple interface for creating and displaying desktop notifications with custom buttons using DBus.

Features:

  • Send notifications with custom titles, messages, and images
  • Interactive Buttons: Include clickable buttons that trigger callbacks
  • Urgency & Sounds: Control urgency levels (0, 1, or 2) and trigger system sounds or file-based alerts
  • Management: Replace, close, or clear all notifications sent by the application
  • Unique Tracking: Use uniqueid to update specific notifications without managing raw notification IDs Note: Some features might have limited support depending on your desktop environment.

Requirements

DBus Notification has minimal system dependencies:

  • Python 3.7 or later
  • jeepney library

Installation

Install the library using pip:

pip install dbus-notification

Usage

Command-Line Interaction

You can send quick notifications directly from your terminal using the following flags:

Flag Description
-t, --title The bold heading of the notification.
-m, --message The body text of the notification.
-l, --logo Path to a small icon/logo.
-i, --image Path to a large image preview.
-s, --sound System sound name (e.g., message-new-instant) or full file path.
-u, --urgency 0 (Low), 1 (Normal), or 2 (Critical).
-c, --timeout Milliseconds until the notification expires (-1 for default).

Example:

dbus-notification -t "Hello" -m "This is a test" -u 1

Programmatic Control

The DBusNotification class allows for advanced interaction and button callbacks.

import time
from dbus_notification import DBusNotification

def callback(notification_type, notification):
    if notification_type == "closed":
        print(f"Notification {notification['id']} has closed.")
    elif notification_type == "button":
        print(f"Notification {notification['id']} has clicked on the button {notification['button']}.")

dbus_app = DBusNotification(appname="dbus_notification", callback=callback)

notification_id = dbus_app.send(
    title="Initial Message",
    message="This message will be replaced in 3 seconds.",
    logo="logo.png",
    image="myimage.png",
    sound="message-new-instant",
    actions=["Test Button"],
    urgency=1,
    timeout=5000, # 5 seconds
    uniqueid="test_notification",
)
time.sleep(3)

notification_id = dbus_app.send(
    title="Updated Message",
    message="This is the new message body.",
    uniqueid="test_notification",
)
time.sleep(3)
dbus_app.close(notification_id)

dbus_app.send(title="N2", message="A second notification.")
dbus_app.send(title="N3", message="A third notification.")
time.sleep(3)

dbus_app.close()

To run a long-running callback monitor from a source checkout:

python examples/callback_monitor.py

To create 10 notifications with unique IDs and close them one by one:

python examples/close_unique_notifications.py

Future Features

  • Support for notification categories
  • Resident or transient notification options
  • Ability to specify notification position on the screen

Metadata

Release files for dbus-notification 2026.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbus-notification 2026.7.0
File Size Uploaded Provenance Actions
dbus_notification-2026.7.0.tar.gz 7.7 kB Without provenance Details for dbus_notification-2026.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbus-notification 2026.7.0
File Interpreter ABI Platform Actions
dbus_notification-2026.7.0-py3-none-any.whl Python 3 none any Details for dbus_notification-2026.7.0-py3-none-any.whl

Total release size: 14.7 kB

Release files / dbus_notification-2026.7.0.tar.gz

Download URL dbus_notification-2026.7.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5bfe74dc540f94e755ee05ce0a7f286e94868579ab21e1b349c65f78a364df48
BLAKE2b-256 checksum
How to use checksums
8b8825ab006279edc1785207f263baf022ea47d26386d3257807b027f582bb1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / dbus_notification-2026.7.0-py3-none-any.whl

Download URL dbus_notification-2026.7.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e443ab3f8eb518e9f57d1e295ebce7a2fa5e080c1763a8fd64c0886dc3202c6
BLAKE2b-256 checksum
How to use checksums
57e0064aa58101c6857e73fd9e22af902b97fdce055a99ee3b219031a14fdc65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for dbus-notification 2026.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page