mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-11 23:32:56 +02:00
Fix window creation due to manual state restore
This commit is contained in:
+3
-27
@@ -1724,8 +1724,7 @@ async fn cmd_check_for_updates(
|
|||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
let mut builder =
|
let mut builder = tauri::Builder::default()
|
||||||
tauri::Builder::default()
|
|
||||||
.plugin(
|
.plugin(
|
||||||
Builder::default()
|
Builder::default()
|
||||||
.targets([
|
.targets([
|
||||||
@@ -1790,18 +1789,7 @@ pub fn run() {
|
|||||||
}))
|
}))
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
.plugin(
|
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||||
tauri_plugin_window_state::Builder::default()
|
|
||||||
.with_denylist(&["ignored"])
|
|
||||||
.map_label(|label| {
|
|
||||||
if label.starts_with(OTHER_WINDOW_PREFIX) {
|
|
||||||
"ignored"
|
|
||||||
} else {
|
|
||||||
label
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.build(),
|
|
||||||
)
|
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_updater::Builder::default().build())
|
.plugin(tauri_plugin_updater::Builder::default().build())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
@@ -2019,9 +2007,7 @@ fn create_main_window(handle: &AppHandle, url: &str) -> WebviewWindow {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let window = create_window(handle, config);
|
create_window(handle, config)
|
||||||
|
|
||||||
window
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CreateWindowConfig<'s> {
|
struct CreateWindowConfig<'s> {
|
||||||
@@ -2115,16 +2101,6 @@ fn create_window(handle: &AppHandle, config: CreateWindowConfig) -> WebviewWindo
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Restore window state if it's a main window
|
|
||||||
let flags = if config.label.starts_with(OTHER_WINDOW_PREFIX) {
|
|
||||||
StateFlags::SIZE // Windows like settings just restore size
|
|
||||||
} else {
|
|
||||||
StateFlags::all() // Main workspace windows restore everything
|
|
||||||
};
|
|
||||||
if let Err(e) = win.restore_state(flags) {
|
|
||||||
warn!("Failed to restore window state {e:?}");
|
|
||||||
}
|
|
||||||
|
|
||||||
win
|
win
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user