https://github.com/bkbilly/dbus_notification
https://github.com/bkbilly/dbus_notification
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bkbilly/dbus_notification
- Owner: bkbilly
- License: mit
- Created: 2024-07-28T00:14:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-28T10:55:51.000Z (almost 2 years ago)
- Last Synced: 2025-03-19T13:39:19.853Z (over 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# DBus Notification
[](https://pypi.python.org/pypi/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:
```bash
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:
```python
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