Skip to main content

Sends notifications using DBus

Project description

DBus Notification

PyPI Python versions License

This library provides a simple interface for creating and displaying desktop notifications with custom buttons. Please note that some features might have varying levels of support across different Linux distributions.

Features:

  • Send notifications with custom titles, messages, and images
  • Include clickable buttons for user interaction
  • Control notification urgency, timeout, and sound Note: Some features might have limited support depending on your desktop environment.

Requirements

DBus Notification has minimal system dependencies:

  • Python 3.7 or later
  • dasdbus library

Installation

Install the library using pip:

pip install dbus-notification

Usage

This library offers two primary usage approaches:

Command-Line Interaction

If you prefer a quick way to view information or control playback, you can potentially execute the dbus-notification script directly, though this doesn't support button actions. For more extensive programmatic control, I would recommend using the library within your Python code.

Programmatic Control

Import the DBusNotification class from your Python code:

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"]}.")

DBusNotification(appname="dbus_notification", callback=callback).send(
    title="test",
    message="this is a test message",
    logo="logo.png",
    image="myimage.png",
    sound="message-new-instant",
    actions=["Test Button"],
    urgency=1,
    timeout=100,
)

# Keep the app running
while True:
    time.sleep(1)

Future Features

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbus_notification-2025.5.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbus_notification-2025.5.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file dbus_notification-2025.5.0.tar.gz.

File metadata

  • Download URL: dbus_notification-2025.5.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for dbus_notification-2025.5.0.tar.gz
Algorithm Hash digest
SHA256 3281deca13a705271adb6e0015e527116cf51bee96c9f806d008621ef1097dec
MD5 ac258fa87f4e0bd0161e793d2dc68fc7
BLAKE2b-256 1d881c1bad382795573d9ab3a19d938613e92fe1b751ee880f17ddfec7632b43

See more details on using hashes here.

File details

Details for the file dbus_notification-2025.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dbus_notification-2025.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8946173f98f18fe76b8ddfa143691a4801f5d560f53a5da7dbdb155a6e4a658
MD5 2f18b8bc85d191027f5741a1ca93caa0
BLAKE2b-256 c11c299c0ea5c41614d04330da2f7c76d08679a4d87cb22c8db27f7e90f1d79e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page