Skip to main content

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.aio.Notify('summary', 'body')
await notify.show()
notify = desktop_notify.glib.Notify('summary', 'body')
notify.set_on_show(callback) # optional
notify.show()
# or
notify.show_async()

Usage with server:

server = desktop_notify.aio.Server('app_name')
notify = server.Notify('summary')
await 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_show and on_close event:

notify.set_on_show(callback(notify))
notify.set_on_close(callback(notify, close_reason))

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:signature:value [key:signature:value ...], -h key:signature:value [key:signature: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.3.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

desktop_notify-1.3.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file desktop-notify-1.3.2.tar.gz.

File metadata

  • Download URL: desktop-notify-1.3.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.6

File hashes

Hashes for desktop-notify-1.3.2.tar.gz
Algorithm Hash digest
SHA256 981f38fa5315b48b2df5f1b79e7b1680da0ad368bda0f8710ebbd6ae6c51feae
MD5 c068c89f562820d9b1636b5ea7dd81bf
BLAKE2b-256 460fc3961894e2751d1cc2facc991178c87f88589c8a71e2e79396dfad65f30e

See more details on using hashes here.

File details

Details for the file desktop_notify-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: desktop_notify-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.6

File hashes

Hashes for desktop_notify-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1fd794c52eab53508143b06b7c8d98ac6ab6edd9b710ed300df8245a2fb0031d
MD5 e3dd12985a094d5456d5a1fd219bbd1e
BLAKE2b-256 b35c5477f6a71baf25f5aab30c320d759a99d4e4811f67ed2ddbe009cbca5884

See more details on using hashes here.

Supported by

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