Util for sending desktop notifications over dbus.
Project description
desktop_notify
Util for sending desktop notifications over dbus. Supports replace_id, hints and actions(mainloop required). Requires dbus-python.
Package usage
Basic notify:
notify = desktop_notify.Notify('summary', 'body')
notify.show()
Usage with server:
server = desktop_notify.Server('app_name')
notify = server.Notify('summary')
notify.show()
Configure notify.
You can setnotify options by default property setter notify.body = 'body'
or using fluent setters:
notify.set_id(0)\
.set_icon('icon')\
.set_timeout(10000) # ms
Extra options
Hints
For workings with hints use this methods:
notify.set_hint(key, value)
notify.get_hint(key)
notify.del_hint(key)
Actions
For using actions and event you need to specify notify server mainloop.
You can add or delete action:
notify.add_action(desktop_notify.Action('label', callback))
notify.del_action(desktop_notify.Action('label', callback))
Also supported on_close
event:
notify.set_on_close(callback)
Mainloop
dbus-python
supports glib
and qt
mainloops.
server = desktop_notify.Server('app_name')\
.init_mainloop_glib()\
.init_mainloop_qt()\
.set_mainloop(my_mainloop)
Console usage
usage: desktop-notify [--help] [--icon ICON] [--id REPLACE_ID] [--timeout TIMEOUT]
[--hints key:value [key:value ...]]
Summary [Body]
Send desktop notification. Returns created notification's id.
positional arguments:
Summary The summary text briefly describing the notification.
Body The optional detailed body text. Can be empty.
optional arguments:
--help show this help message and exit
--icon ICON, -i ICON The optional program icon of the calling application.
Should be either a file path or a name in a
freedesktop.org-compliant icon theme.
--id REPLACE_ID An optional ID of an existing notification that this
notification is intended to replace.
--timeout TIMEOUT, -t TIMEOUT
The timeout time in milliseconds since the display of
the notification at which the notification should
automatically close.
--hints key:value [key:value ...], -h key:value [key:value ...]
use "--" to separate hints list from positional args
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
desktop-notify-1.2.0.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file desktop-notify-1.2.0.tar.gz
.
File metadata
- Download URL: desktop-notify-1.2.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321f597f4b5b7d7e9b631249153da083d9b96a0a8be2093e372840e70e669bbb |
|
MD5 | c3592b1b989ec49c5bbb93f845a941f3 |
|
BLAKE2b-256 | 2b0fc543fb6ee5f63be9864302b5d5da98eb4d10bf3a5d71ad320ef7980a1726 |
File details
Details for the file desktop_notify-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: desktop_notify-1.2.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 888a766119c0bda92143c87f89e669a89f5aac574eecbbd865f05543c1b547e3 |
|
MD5 | 6ce3a7ea30a85f84ccaba1f22bc10d2b |
|
BLAKE2b-256 | 027ad059e739a0045841d0c9a35c7f26c68597c09fed9dbbb5cb22bc9c5da169 |