[desktop] tauri fix main windows size and theme

This commit is contained in:
Vladimir Stoilov
2024-07-23 17:26:53 +03:00
parent 674787df87
commit 5b03076fac
2 changed files with 8 additions and 3 deletions

View File

@@ -21,12 +21,15 @@
"window:allow-show", "window:allow-show",
"window:allow-is-visible", "window:allow-is-visible",
"window:allow-set-focus", "window:allow-set-focus",
"window:allow-close",
"app:default", "app:default",
"image:default", "image:default",
"resources:default", "resources:default",
"menu:default", "menu:default",
"tray:default", "tray:default",
"shell:allow-open", "shell:allow-open",
"notification:default" "notification:default",
"window-state:allow-save-window-state",
"window-state:allow-restore-state"
] ]
} }

View File

@@ -1,6 +1,7 @@
use log::{debug, error}; use log::{debug, error};
use tauri::{ use tauri::{
AppHandle, Manager, Result, UserAttentionType, WebviewUrl, WebviewWindow, WebviewWindowBuilder, AppHandle, Listener, Manager, Result, Theme, UserAttentionType, WebviewUrl, WebviewWindow,
WebviewWindowBuilder,
}; };
use crate::portmaster::PortmasterExt; use crate::portmaster::PortmasterExt;
@@ -16,7 +17,6 @@ use crate::portmaster::PortmasterExt;
pub fn create_main_window(app: &AppHandle) -> Result<WebviewWindow> { pub fn create_main_window(app: &AppHandle) -> Result<WebviewWindow> {
let mut window = if let Some(window) = app.get_webview_window("main") { let mut window = if let Some(window) = app.get_webview_window("main") {
debug!("[tauri] main window already created"); debug!("[tauri] main window already created");
window window
} else { } else {
debug!("[tauri] creating main window"); debug!("[tauri] creating main window");
@@ -24,6 +24,8 @@ pub fn create_main_window(app: &AppHandle) -> Result<WebviewWindow> {
let res = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html".into())) let res = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html".into()))
.title("Portmaster") .title("Portmaster")
.visible(false) .visible(false)
.inner_size(1200.0, 700.0)
.theme(Some(Theme::Dark))
.build(); .build();
match res { match res {