Open madsmtm opened 1 month ago
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...
Also, it spikes the CPU to maximum as soon as running the notify
example.
The current detection mechanism just runs
detect
in a loop, which is woefully inefficient. Details on more efficient implementation options in https://github.com/frewsxcv/rust-dark-light/pull/37#issuecomment-2123412904 and https://github.com/cormacrelf/dark-notify/blob/master/src/app.rs.Also, it doesn't actually work, see https://github.com/frewsxcv/rust-dark-light/issues/29. I suspect that the problem is that we need to be running the main application with
NSApplication::run
orNSApplicationMain
for this to work? But semantically, that probably isn't really something thatrust-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 https://github.com/madsmtm/objc2/issues/279 for that.