wail icon indicating copy to clipboard operation
wail copied to clipboard

Integrate with OS X notification center

Open machawk1 opened this issue 12 years ago • 5 comments

machawk1 avatar Apr 09 '13 17:04 machawk1

The PyObjC package provides native bindings to many of the APIs and functionality including the notification center. WAIL does not currently utilize this module but might should, as it looks to have more potential for the OS X version of WAIL.

machawk1 avatar Jan 21 '16 18:01 machawk1

https://github.com/dschep/ntfy module may be helpful as a cross-platform solution to accomplishing this. A particular use case lies in alerting the user when a crawl has finished.

On second thought, ntfy does not look to have an API to allow it to be imported and used from other code.

machawk1 avatar Dec 14 '17 15:12 machawk1

@machawk1 you definitly can use ntfy as a python API, it's just not the primary use case so I haven't really documented it.

you can use:

import ntfy
ntfy.notify('a message', 'title')

but this will use the user's ntfy config so might not work as you want.

To ignore the user's config and use their platform's desktop notifications you can do:

from ntfy.backends.default import notify
notify('a message', 'title')

dschep avatar Dec 14 '17 17:12 dschep

@dschep Thank you for this information. I'll test it out and see if it works for our use case.

machawk1 avatar Dec 14 '17 17:12 machawk1

Circling back, in using @dschep's sample above as tied to a button click event, I am unable to see a notification displayed. Using the snippet in a stand-alone script works as expected. I'm wondering if there's a conflict with, say, wxPython (e.g., https://wxpython.org/Phoenix/docs/html/wx.adv.NotificationMessage.html That's used for ALERTs) and ntfy.

machawk1 avatar Feb 07 '18 23:02 machawk1