hoodie / notify-rust

☝️send desktop notifications from your Rust app.
Apache License 2.0
1.13k stars 73 forks source link

Implement notification listener for mac and windows #200

Closed Rutik7066 closed 7 months ago

Rutik7066 commented 7 months ago

Description

This PR implements listeners for mac and windows. But doesn't handle the recieved notification. I will need further guidance for that.

macOS

Used org.freedesktop.Notifications interface provided by the Notification Daemon (notify-osd).

Windows

Used winrt-notification.

TODO

ofek commented 7 months ago

Thanks, I'm very excited for this!

hoodie commented 7 months ago

I'm sorry, but I don't understand what you're trying to achieve here.

ofek commented 7 months ago

Do you have ideas on implementing for Windows and macOS?

hoodie commented 7 months ago

I'm sorry. I ough you a more constructive response than what I gave. Unfortunuately I don't see that this PR will work from the fact that it contains a dbus based implementation in themacos.rs module. I am still very interested in adding this functionality, please open a new PR when you have a more complete implementation.

Rutik7066 commented 7 months ago

Hi @hoodie. First thanks for review. I agree that was naive implement i did reasearch on it mac-notification-sys doesn't support for listening to notification i am planning to utilise dbus or zbus for to listen to notifications and adding handlers to it. Will that be okay?

hoodie commented 7 months ago

Unfortunately that is not how it works. mac-notification-sys works completely differently than this library. dbus/zbus are for talking to the xdg notification services (linux/bsd etc). MacOS/Windows have to use different system APIs. The Problem with listeners on macOS is tat you have to wait for them on the main thread (AFAIK). That, plus you might have to use the newer APIs (which mac-notification-sys does not use yet). So I would suggest to focus on one OS for now.