Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

Add enable tauri new window open handling.

GXiang94e61c3b5427
diff --git a/src-tauri/pake.json b/src-tauri/pake.json
index 60f9b590..ae40f822 100644
--- a/src-tauri/pake.json
+++ b/src-tauri/pake.json
@@ -18,7 +18,8 @@
"enable_drag_drop": false,
"maximize": false,
"start_to_tray": false,
- "force_internal_navigation": false
+ "force_internal_navigation": false,
+ "enable_tauri_new_window": false
}
],
"user_agent": {
diff --git a/src-tauri/src/app/config.rs b/src-tauri/src/app/config.rs
index ca4c7546..a708dfe6 100644
--- a/src-tauri/src/app/config.rs
+++ b/src-tauri/src/app/config.rs
@@ -19,6 +19,7 @@ pub struct WindowConfig {
pub title: Option<String>,
pub enable_wasm: bool,
pub enable_drag_drop: bool,
+ pub enable_tauri_new_window: bool,
pub start_to_tray: bool,
#[serde(default)]
pub force_internal_navigation: bool,
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 8fadfb2c..13a00dd2 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -82,6 +82,12 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
window_builder = window_builder.disable_drag_drop_handler();
}
+ if window_config.enable_tauri_new_window {
+ window_builder = window_builder.on_new_window(move |_url, _features| {
+ tauri::webview::NewWindowResponse::Allow
+ })
+ }
+
// Add initialization scripts
window_builder = window_builder
.initialization_script(&config_script)