[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
No known key found for this signature in database
GPG key ID: 2F190B67A43A81AF
2 changed files with 8 additions and 3 deletions
desktop/tauri/src-tauri
capabilities
src

View file

@ -21,12 +21,15 @@
"window:allow-show",
"window:allow-is-visible",
"window:allow-set-focus",
"window:allow-close",
"app:default",
"image:default",
"resources:default",
"menu:default",
"tray:default",
"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 tauri::{
AppHandle, Manager, Result, UserAttentionType, WebviewUrl, WebviewWindow, WebviewWindowBuilder,
AppHandle, Listener, Manager, Result, Theme, UserAttentionType, WebviewUrl, WebviewWindow,
WebviewWindowBuilder,
};
use crate::portmaster::PortmasterExt;
@ -16,7 +17,6 @@ use crate::portmaster::PortmasterExt;
pub fn create_main_window(app: &AppHandle) -> Result<WebviewWindow> {
let mut window = if let Some(window) = app.get_webview_window("main") {
debug!("[tauri] main window already created");
window
} else {
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()))
.title("Portmaster")
.visible(false)
.inner_size(1200.0, 700.0)
.theme(Some(Theme::Dark))
.build();
match res {