Open Jarrodsz opened 1 year ago
Additional:
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
"check_for_updates" => {}
"settings" => {
let w = app.get_window("settings").unwrap();
w.show().unwrap();
w.set_focus().unwrap();
}
.setup(|app| {
let app_handle = app.handle();
match ui::setup_settings_window(&app_handle) {
Ok(settings_window) => {
settings_window.set_always_on_top(true).unwrap();
}
Err(e) => {
println!("Failed to setup settings window: {}", e);
}
}
Ok(())
})
settings window initiated from:
pub fn setup_settings_window<R: Runtime>(app_handle: &AppHandle<R>) -> Result<Window<R>> {
let settings_window = WindowBuilder::new(
app_handle,
crate::SETTINGS_WINDOW_LABEL,
WindowUrl::App("/pages/settings/settings.html".into()),
)
.visible(false)
.resizable(false)
.inner_size(500., 400.)
.skip_taskbar(true)
.decorations(true)
.focused(true)
.build()?;
Ok(settings_window)
}
Describe the bug
when building a tray
causes a bug with additional windows beeing created having no focus. on osx. you cannot close the window by clicking the (x) without clicking 2 times on the window! also you have no focus on the window so say you wanted to click a button in the window itself, then you would have to click 2 times.. 1 click to get the window respond or get focus 2. to close the window with (x) or click any additional elements in the window.
with
it works correctly, very ugly bug wasted hours and hours on finding out this was the reason
Reproduction
see above just create a tray with a option that opens a window.
add the tray as
.system_tray(SystemTray::new().with_menu(tray_menu).with_menu_on_left_click(true))
to view the 2 times click bug.
or
which works fine
Expected behavior
be able to use
without it messes up my additional windows and require me to click 2 times on it!!
Additional setting the setting not in code but from the config does not seem to do anything ! so true or false does not do anything
Platform and versions
Stack trace
Additional context
on osx i have not tested how this behaves on windows