add zoom,min-height,min-width params

This commit is contained in:
Tw93
2025-11-21 10:53:59 +08:00
parent 9c7330143a
commit f7a24bb26f
10 changed files with 200 additions and 1 deletions

View File

@@ -22,6 +22,18 @@ pub struct WindowConfig {
pub start_to_tray: bool,
#[serde(default)]
pub force_internal_navigation: bool,
#[serde(default = "default_zoom")]
pub zoom: u32,
#[serde(default)]
pub min_width: f64,
#[serde(default)]
pub min_height: f64,
#[serde(default)]
pub ignore_certificate_errors: bool,
}
fn default_zoom() -> u32 {
100
}
#[derive(Debug, Serialize, Deserialize)]

View File

@@ -64,6 +64,12 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
.always_on_top(window_config.always_on_top)
.incognito(window_config.incognito);
if window_config.min_width > 0.0 || window_config.min_height > 0.0 {
let min_w = if window_config.min_width > 0.0 { window_config.min_width } else { window_config.width };
let min_h = if window_config.min_height > 0.0 { window_config.min_height } else { window_config.height };
window_builder = window_builder.min_inner_size(min_w, min_h);
}
if !window_config.enable_drag_drop {
window_builder = window_builder.disable_drag_drop_handler();
}
@@ -82,6 +88,23 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
#[cfg(all(not(target_os = "windows"), not(target_os = "macos")))]
let mut linux_browser_args = String::from("--disable-blink-features=AutomationControlled");
if window_config.ignore_certificate_errors {
#[cfg(target_os = "windows")]
{
windows_browser_args.push_str(" --ignore-certificate-errors");
}
#[cfg(all(not(target_os = "windows"), not(target_os = "macos")))]
{
linux_browser_args.push_str(" --ignore-certificate-errors");
}
#[cfg(target_os = "macos")]
{
window_builder = window_builder.additional_browser_args("--ignore-certificate-errors");
}
}
if window_config.enable_wasm {
#[cfg(target_os = "windows")]
{

View File

@@ -896,6 +896,8 @@ function setDefaultZoom() {
const htmlZoom = window.localStorage.getItem("htmlZoom");
if (htmlZoom) {
setZoom(htmlZoom);
} else if (window.pakeConfig?.zoom && window.pakeConfig.zoom !== 100) {
setZoom(`${window.pakeConfig.zoom}%`);
}
}