Sends notifications using DBus
Project description
DBus Notification
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:
def callback(notification_type, notification_id, reason):
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 {reason}.")
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dbus_notification-2024.7.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff7e19508cbb0d504a34eb4937ed266d61b03fa6eecd95603f01fa3648ae9935 |
|
MD5 | 3ab7add36f4ef17fa28b1883c26afd6d |
|
BLAKE2b-256 | 3eeec8b9e47d2e5e687df9200843340eab1dda226753f911c94aabaaae564b63 |
Hashes for dbus_notification-2024.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1233a04de593d05e0c5cfc97a81aaa9db816111643f5c077edabde009f1f5732 |
|
MD5 | b9f03f3eeab3840ae5d8fe534857f72b |
|
BLAKE2b-256 | a51d0f2422dd051a7607cd7f5f9023c107e4afbeb9750abef75ff654f2ca45a2 |