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

macOS: Notes on notification detection #47

Open
madsmtm opened this issue Oct 8, 2024 · 2 comments
Open

macOS: Notes on notification detection #47

madsmtm opened this issue Oct 8, 2024 · 2 comments

Comments

@madsmtm
Copy link
Contributor

madsmtm commented Oct 8, 2024

The current detection mechanism just runs detect in a loop, which is woefully inefficient. Details on more efficient implementation options in #37 (comment) and https://github.com/cormacrelf/dark-notify/blob/master/src/app.rs.

Also, it doesn't actually work, see #29. I suspect that the problem is that we need to be running the main application with NSApplication::run or NSApplicationMain for this to work? But semantically, that probably isn't really something that rust-dark-light should be doing, so unsure what to do.

Even if that isn't the problem, or it can be worked around by using "AppleInterfaceThemeChangedNotification", another problem is that most Rust async runtimes don't support mach ports, and as such wouldn't update since notifications arrive via. those, I think? See madsmtm/objc2#279 for that.

@Be-ing
Copy link
Collaborator

Be-ing commented Oct 9, 2024

Hmm, I'm wondering if we should make the async API platform-specific until someone steps up to implement proper async support for every OS...

@casperstorm
Copy link

Also, it spikes the CPU to maximum as soon as running the notify example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants