fix(desktop): focus window after update/relaunch (#13701)
This commit is contained in:
@@ -22,6 +22,8 @@ impl MainWindow {
|
|||||||
|
|
||||||
pub fn create(app: &AppHandle) -> Result<Self, tauri::Error> {
|
pub fn create(app: &AppHandle) -> Result<Self, tauri::Error> {
|
||||||
if let Some(window) = app.get_webview_window(Self::LABEL) {
|
if let Some(window) = app.get_webview_window(Self::LABEL) {
|
||||||
|
let _ = window.set_focus();
|
||||||
|
let _ = window.unminimize();
|
||||||
return Ok(Self(window));
|
return Ok(Self(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +52,9 @@ impl MainWindow {
|
|||||||
|
|
||||||
let window = window_builder.build()?;
|
let window = window_builder.build()?;
|
||||||
|
|
||||||
|
// Ensure window is focused after creation (e.g., after update/relaunch)
|
||||||
|
let _ = window.set_focus();
|
||||||
|
|
||||||
setup_window_state_listener(app, &window);
|
setup_window_state_listener(app, &window);
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|||||||
Reference in New Issue
Block a user