refactor: remove platform-specific tauri conf

Merge windows back to main tauri config. The reason I separated them was
because I need decoration: true on mac and false on windows and linux.
Now I use tauri rust API to set decorations to false for win and linux.
This commit is contained in:
Huakun Shen 2024-12-20 11:44:57 -05:00
parent df1213e87a
commit 656100cb76
No known key found for this signature in database
5 changed files with 29 additions and 71 deletions

View File

@ -55,11 +55,17 @@ impl<R: Runtime> WindowExt for WebviewWindow<R> {
pub fn setup_window<R: Runtime>(app: &AppHandle<R>) { pub fn setup_window<R: Runtime>(app: &AppHandle<R>) {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
app.get_webview_window("main") let main_win = app.get_webview_window("main").unwrap();
.unwrap() main_win.set_transparent_titlebar(true, true);
.set_transparent_titlebar(true, true); let splashscreen_win = app.get_webview_window("splashscreen").unwrap();
app.get_webview_window("splashscreen") splashscreen_win.set_transparent_titlebar(true, true);
.unwrap() }
.set_transparent_titlebar(true, true); #[cfg(not(target_os = "macos"))]
{
// on linux or windows, set decorations to false
let main_win = app.get_webview_window("main").unwrap();
main_win
.set_decorations(false)
.expect("Failed to set decorations");
} }
} }

View File

@ -13,7 +13,23 @@
"macOSPrivateApi": true, "macOSPrivateApi": true,
"security": { "security": {
"csp": null "csp": null
} },
"windows": [
{
"hiddenTitle": true,
"url": "/app",
"title": "Kunkun",
"width": 800,
"visible": false,
"height": 600,
"decorations": true
},
{
"url": "/splashscreen",
"visible": false,
"label": "splashscreen"
}
]
}, },
"bundle": { "bundle": {
"createUpdaterArtifacts": true, "createUpdaterArtifacts": true,

View File

@ -1,22 +0,0 @@
{
"identifier": "sh.kunkun.desktop",
"app": {
"windows": [
{
"hiddenTitle": true,
"url": "/app",
"title": "Kunkun",
"width": 800,
"height": 600,
"visible": false,
"decorations": false
},
{
"url": "/splashscreen",
"label": "splashscreen",
"visible": false,
"decorations": false
}
]
}
}

View File

@ -1,20 +0,0 @@
{
"identifier": "sh.kunkun.desktop",
"app": {
"windows": [
{
"hiddenTitle": true,
"url": "/app",
"title": "Kunkun",
"width": 800,
"visible": false,
"height": 600
},
{
"url": "/splashscreen",
"visible": false,
"label": "splashscreen"
}
]
}
}

View File

@ -1,22 +0,0 @@
{
"identifier": "sh.kunkun.desktop",
"app": {
"windows": [
{
"hiddenTitle": true,
"url": "/app",
"title": "Kunkun",
"width": 800,
"height": 600,
"visible": false,
"decorations": false
},
{
"url": "/splashscreen",
"label": "splashscreen",
"visible": false,
"decorations": false
}
]
}
}