frewsxcv / rust-dark-light

Rust crate to detect if dark mode or light mode is enabled
https://crates.io/crates/dark-light
73 stars 12 forks source link

Does not detect mode change #29

Open kek opened 1 year ago

kek commented 1 year ago

@edfloreshz writes in https://github.com/frewsxcv/rust-dark-light/issues/3#issuecomment-1013984546, "I'm calling dark-light::detect on a loop and invoking the callback function when the theme changes." which indicates to me that it should at least under some circumstances be possible to call the detect function several times during the lifetime of a program and get the current setting. However this does not seem to be the case for me since it only reports what the setting was when the program was started.

Attaching a kind of test case:

fn main() {
    println!("Darklight mode: {:?}", dark_light::detect());
    println!("Change your mode and press enter");
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    println!("Darklight mode: {:?}", dark_light::detect());
}

Output:

Lightness mode: Light
Change your mode and press enter

Lightness mode: Light

Tested on Macos 13.3.1.

AregevDev commented 12 months ago

Bump. It works as intended on Windows 11. Will test on my KDE machine later.

edfloreshz commented 10 months ago

@kek Unfortunately I'm unable to test this on macOS, I don't own a Mac. Perhaps someone else could help us replicate this issue?

kek commented 10 months ago

Would a screen recording help? Also, it might be useful for me to check if this is still an issue.

edfloreshz commented 10 months ago

Sure, you can add it to the issue description.

fenhl commented 5 months ago

I can reproduce this issue on macOS 14.2.1.

jacksongoode commented 4 months ago

Hmm, is this planning on being fixed in https://github.com/frewsxcv/rust-dark-light/pull/26? Or is there a workaround you found?