Notifications

New in version 1.15.

Note

Notifications are only available on Mountain Lion (10.8) and later. Calling notify() on earlier systems will silently fail.

Alfred 3 allows you to post notifications, but only at the end of a workflow, and only with its own icon.

Alfred-PyWorkflow’s notify module lets you post notifications whenever you want, and with your workflow’s icon.

Usage

1from workflow.notify import notify
2
3notify('My Title', 'My Text')

This is the full API:

workflow.notify.notify(title='', subtitle='', message='', sound=None)

Post notification via notificator helper app from Vítor Galvão.

Parameters:
  • title (str, optional) – Notification title.

  • subtitle (str, optional) – Notification title.

  • message (str) – Notification body text.

  • sound (str, optional) – Name of sound to play.

Raises:

ValueError – Raised if both title and text are empty.

Returns:

True if notification was posted, else False.

Return type:

bool

See the API documentation for details of the other functions.