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

Support running without a windowing framework #198

Closed
JerwuQu opened this issue Oct 9, 2024 · 1 comment
Closed

Support running without a windowing framework #198

JerwuQu opened this issue Oct 9, 2024 · 1 comment

Comments

@JerwuQu
Copy link

JerwuQu commented Oct 9, 2024

The tray-icon event receivers rely on another library (or manual implementation) to churn a event loop. It would be nice if the library could take care of this itself.

Getting it working on Windows just required the following:

loop {
    unsafe {
        let mut msg: MSG = std::mem::zeroed();
        while PeekMessageW(&mut msg, null_mut(), 0, 0, 1) > 0 {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }
    }

    ...handle tray events...
    ...maybe sleep a bit...
}
@amrbashir
Copy link
Member

The tray-icon crate works without a windowing framework, you just need bring your event loop, whether that comes from winit, tao, egui, or manual event loop in that case.

This crate only concern is to create the tray and handle its events. That's it, simple and to the point. Making an event loop built-in is reinventing the wheel as there is a lot of GUI event loop out there.

If your aim is minimalist event loop, I think it might be a good choice to write another crate and I will happily mention it in the docs and add examples.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
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

2 participants