Notifications aren’t available in version of OS X older than 10.8/Mountain Lion. Calling notify() on these systems will silently do nothing.

notify allows you to post notifications via OS X’s Notification Center at any time, not just at the end of your script. Furthermore, it uses your workflow’s icon, not Alfred’s.

The only functions that you should need to use directly to post notifications are notify() and possibly validate_sound().

The image-processing functions convert_image() and png_to_icns() might be useful outside of this library.


Post notifications via the OS X Notification Center. This feature is only available on Mountain Lion (10.8) and later. It will silently fail on older systems.

The main API is a single function, notify().

It works by copying a simple application to your workflow’s data directory. It replaces the application’s icon with your workflow’s icon and then calls the application to post notifications.

workflow.notify.convert_image(inpath, outpath, size)

Convert an image file using sips.

  • inpath (str) – Path of source file.
  • outpath (str) – Path to destination file.
  • size (int) – Width and height of destination image in pixels.

RuntimeError – Raised if sips exits with non-zero status.


Extract from the workflow to data directory.

Changes the bundle ID of the installed app and gives it the workflow’s icon.


Return logger for this module.

Returns:Logger for this module.
Return type:logging.Logger

Return path to icon file in installed

Returns:Path to applet.icns within the app bundle.
Return type:unicode

Return path to notifier applet executable.

Returns:Path to applet executable.
Return type:unicode
workflow.notify.notify(title=u'', text=u'', sound=None)

Post notification via helper.

  • title (str, optional) – Notification title.
  • text (str, optional) – Notification body text.
  • sound (str, optional) – Name of sound to play.

ValueError – Raised if both title and text are empty.


True if notification was posted, else False.

Return type:


workflow.notify.png_to_icns(png_path, icns_path)

Convert PNG file to ICNS using iconutil.

Create an iconset from the source PNG file. Generate PNG files in each size required by OS X, then call iconutil to turn them into a single ICNS file.

  • png_path (str) – Path to source PNG file.
  • icns_path (str) – Path to destination ICNS file.

RuntimeError – Raised if iconutil or sips fail.


Coerce sound to valid sound name.

Returns None for invalid sounds. Sound names can be found in System Preferences > Sound > Sound Effects.

Parameters:sound (str) – Name of system sound.
Returns:Proper name of sound or None.
Return type:str

Return Workflow object for this module.

Returns:Workflow object for current workflow.
Return type:workflow.Workflow