This commit is contained in:
cast1e
2024-09-26 07:32:31 +08:00
parent e8a3653499
commit 3aae49057c
17 changed files with 1991 additions and 21 deletions
+13
View File
@@ -76,6 +76,7 @@ dependencies = [
"serde_json",
"tauri",
"tauri-build",
"window-shadows",
"window-vibrancy",
]
@@ -3413,6 +3414,18 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "window-shadows"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ff424735b1ac21293b0492b069394b0a189c8a463fb015a16dea7c2e221c08"
dependencies = [
"cocoa 0.25.0",
"objc",
"raw-window-handle",
"windows-sys 0.48.0",
]
[[package]]
name = "window-vibrancy"
version = "0.4.3"
+2 -1
View File
@@ -17,8 +17,9 @@ tauri-build = { version = "1.5.5", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.8.0", features = [] }
tauri = { version = "1.8.0", features = [ "window-minimize", "window-maximize", "window-close", "window-show", "window-hide", "window-start-dragging", "window-unminimize", "window-unmaximize"] }
window-vibrancy = "0.4"
window-shadows = "0.2.2"
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
+2 -1
View File
@@ -4,7 +4,8 @@
mod setup;
fn main() {
tauri::Builder::default().setup(setup::init)
tauri::Builder::default()
.setup(setup::init)
.invoke_handler(tauri::generate_handler![test_command])
.run(tauri::generate_context!())
.expect("error while running tauri application");
+6 -3
View File
@@ -1,10 +1,11 @@
use tauri::{App, Manager};
use window_vibrancy::{self, NSVisualEffectMaterial};
use window_shadows::set_shadow;
/// setup
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
let win = app.get_window("main").unwrap();
// 仅在 macOS 下执行
#[cfg(target_os = "macos")]
window_vibrancy::apply_vibrancy(&win, NSVisualEffectMaterial::FullScreenUI)
@@ -12,7 +13,9 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
// 仅在 windows 下执行
#[cfg(target_os = "windows")]
window_vibrancy::apply_acrylic(&win, Some((18, 18, 18, 125)))
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");
if let Err(_) = window_vibrancy::apply_mica(&win, None){
window_vibrancy::apply_acrylic(&win, Some((10,10,10,180))).expect("Unsupport Blur Effect!")
}
set_shadow(&win, true).unwrap();
Ok(())
}
+14 -2
View File
@@ -12,7 +12,18 @@
},
"tauri": {
"allowlist": {
"all": false
"all": false,
"window": {
"all": false,
"close": true,
"hide": true,
"show": true,
"maximize": true,
"minimize": true,
"unmaximize": true,
"unminimize": true,
"startDragging": true
}
},
"bundle": {
"active": true,
@@ -59,8 +70,9 @@
"height": 600,
"resizable": true,
"title": "wallitor-gui",
"transparent": true,
"width": 800,
"transparent": true
"decorations": false
}
]
}