修复 macOS 窗口圆角显示异常

This commit is contained in:
JSR
2026-03-19 18:06:42 +08:00
parent e4a0eb1ad8
commit 6675b6d978
5 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ crate-type = ["staticlib", "cdylib", "lib"]
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = ["tray-icon", "image-png", "protocol-asset"] }
tauri = { version = "2", features = ["macos-private-api", "tray-icon", "image-png", "protocol-asset"] }
tauri-plugin-shell = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+5
View File
@@ -298,6 +298,11 @@ fn setup_tray(_app: &mut App) -> Result<(), Box<dyn std::error::Error>> {
#[cfg(desktop)]
fn setup_window_events(app: &mut App) -> Result<(), Box<dyn std::error::Error>> {
if let Some(window) = app.get_webview_window("main") {
#[cfg(target_os = "macos")]
{
let _ = window.set_shadow(true);
}
let window_clone = window.clone();
window.on_window_event(move |event| {
if let WindowEvent::CloseRequested { api, .. } = event {
+2 -1
View File
@@ -11,6 +11,7 @@
},
"app": {
"withGlobalTauri": true,
"macOSPrivateApi": true,
"windows": [
{
"title": "SecScore",
@@ -19,7 +20,7 @@
"resizable": true,
"fullscreen": false,
"decorations": false,
"transparent": false,
"transparent": true,
"center": true,
"minWidth": 800,
"minHeight": 600