Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop notifications for macOS and Windows #216

Closed
amotl opened this issue Mar 19, 2020 · 12 comments
Closed

Desktop notifications for macOS and Windows #216

amotl opened this issue Mar 19, 2020 · 12 comments

Comments

@amotl
Copy link
Collaborator

amotl commented Mar 19, 2020

💡 The Idea
I recognize Notify_dbus and Notify_gnome are plugins to display - nomen est omen ;] - notifications on the user's desktop.

Unless I've missed something, both will be specific to Linux environments. How about to extend that to the macOS and Windows environment?

As a blueprint, you might want to visit the notify_user function from our pen. It uses py-notifier on Linux, pync on macOS (with an optional fallback by shelling out to osascript) and zroya on Windows.

💭 Thoughts
When having this on the workbench already, we might think about grouping all possible ways to submit desktop notifications within a dedicated documentation section.

@geeseven
Copy link
Collaborator

Hey @amotl,

Does the Windows Notification service not work for you?

@amotl
Copy link
Collaborator Author

amotl commented Mar 19, 2020

Dear @geeseven,

thanks for your response. I haven't been able to find the Windows Notification service because I searched the Wiki for "desktop". If somebody could add that word to the Wiki page, this would be perfect. For me, searching for "desktop notification" was obvious to do and it might be for others as well.

This also resonates with my proposal to add a respective section to the documentation which might want to group pointers to all desktop notification plugins.

Apart from that, I am actually on macOS ;].

Cheers,
Andreas.

@geeseven
Copy link
Collaborator

@amotl,

I think you might be on to something with documentation. The main wiki page has icons for attachments and SMS support. Do you think that adding an icon for desktop support would be enough?

Another option could be breaking the services in categories. The README.md does this to some degree. @caronc, what do you think about adding more categories like chat, social media, native desktop, media center, ect? I would be more than happen to submit a pull request.

@amotl
Copy link
Collaborator Author

amotl commented Mar 19, 2020

Unfortunately, the Wiki can not be updated using pull requests, right? Or did GitHub even upgrade it in the meanwhile?

@caronc
Copy link
Owner

caronc commented Mar 19, 2020

Hi guys, so is what you're looking for on the wiki? Just a new icon for services that stay local (like dbus, and windows)? That will only really apply to 3 plugins... Perhaps i could take them out of the big list and group them separately (like i do the custom JSON and XML ones?). Alternatively, maybe the landing page needs a bit of a reformatting? 🤷‍♂️

I had a look at pync (Mac Support) and it literally just boils down to an external shell command (source). An Apprise plugin that just does this exact thing would be super easy to do, I probably wouldn't bother importing pync, I'd just access the terminal-notifier binary directly in the plugin. I wonder if there is actually a better way to grant you mac support than having a Python script wrap a shell script though?

You are correct that the wiki can't be changed through PR's. I've just granted a few people privileges to change it at this time @geeseven is one of them 😉 .

Thank you both for all of your brainstorming! I think i answered everything here. Seems like the summary from this is:

  • Make it more obvious the Linux/Windows support on Wiki
  • Add Mac Support

@amotl
Copy link
Collaborator Author

amotl commented Mar 20, 2020

Dear Chris,

thanks for appreciating our suggestions.

I probably wouldn't bother importing pync.

TerminalNotifier.py seems to sort out many things, for example appropriate support for Python2 vs. Python3, see [1]. Before having to sort out stuff like this afterwards, I would just build upon pync ;].

Perhaps i could take them out of the big list and group them separately.
Make it more obvious the Linux/Windows support on Wiki.

That would be cool re. documentation. Please don't forget the "desktop" keyword as I believe many people will just look/search for "desktop notification".

With kind regards,
Andreas.

[1] https://github.com/SeTeM/pync/blob/master/pync/TerminalNotifier.py#L72-L73

@caronc
Copy link
Owner

caronc commented Mar 29, 2020

TerminalNotifier.py seems to sort out many things, for example appropriate support for Python2 vs. Python3, see [1]. Before having to sort out stuff like this afterwards, I would just build upon pync ;].

Thanks @amotl ; I do really appreciate your feedback. This will be the only time (so far 😉) that I have to disagree with you! 🙂

I think the (pync) library has maturity; I'll agree with you here that is definitely where it shines. But there are things I don't like that it does, such as setting executable bits on binary files (here. pync should be a read/execute tool only.

It doesn't quite sort out the Python v2 and v3 like your link suggested because there is a lingering pull request on the same project that the suggests that this very code snippet is interfering with their system (but works when removed) - see here.

Apprise will only utilize terminal-notifier to send notifications (and nothing more), so I personally do not see the need to incorporate the extra bulk that ships with the pync library for such a trivial task (which is just a single call to subprocess.Popen()). Up until now, I've gone through great lengths to keep Apprise lightweight (no Twitter, Amazon SNS, Slack, libraries), this just falls in the same situation (I think).

That would be cool re. documentation. Please don't forget the "desktop" keyword as I believe many people will just look/search for "desktop notification".

Sounds good! I started this on the wiki here 🙂. In this PR I'll update the README.md to show the same/similar thing. It will also include MacOS X Notifications as well.

This PR is almost done, I just need to add unit tests around it. I should probably add support for the .app bundle version explained here. As of now, this new notification wrapper expects to find the tool exclusively in /usr/local/bin/terminal-notifier.

@amotl
Copy link
Collaborator Author

amotl commented Mar 29, 2020

Dear Chris,

thanks for your thorough investigation of the pync code base. I totally agree with you about your findings. Thanks also for adding [1] - should we also reference Notify_gnome here?

Cheers,
Andreas.

[1] https://github.com/caronc/apprise/wiki#desktop-notification-services

@caronc
Copy link
Owner

caronc commented Mar 29, 2020

Doh! 🤦‍♂️

Good catch! I updated the wiki again. Thank you for noticing that! 🙂

@caronc
Copy link
Owner

caronc commented Mar 29, 2020

@amotl I am about to merge and close this issue off to. After that i can do an official release. Since i don't have a Mac, would you be able to check out this branch and give it a try? If anyone else reading this can try it out for me too (instead), that would be awesome! 🙂

I apologize for asking so much of you, but if you can prove these things work, they can be part of the next official release. So it's a win win. I've also started the wiki page that will represent this new service here.

@caronc
Copy link
Owner

caronc commented Mar 31, 2020

#221 is merged now and both the README.md (link) and wiki have been updated to help with your reference to the keyword Desktop (in addition to the notification grouping). Plus you got your MacOSX notification too! 🙂

I think we nailed this one eh? Are you okay if I close this ticket off?

@amotl
Copy link
Collaborator Author

amotl commented Mar 31, 2020

Dear Chris,

thanks a bunch for all the efforts you've put into this.

Are you okay if I close this ticket off?

Please do!

Cheers,
Andreas.

@caronc caronc closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants