From 7576411a66a4a7efd19a266d82171b699a655bd1 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Tue, 14 Apr 2026 17:29:15 -0700 Subject: [PATCH] Add window blur & set minimum macOS version --- src-tauri/Cargo.toml | 3 ++- src-tauri/src/lib.rs | 20 ++++++++++++++++++++ src-tauri/tauri.conf.json | 9 +++++++-- src/app/globals.css | 5 +++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d39f8c1..8591876 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -12,9 +12,10 @@ crate-type = ["staticlib", "cdylib", "rlib"] tauri-build = { version = "2.5.6", features = [] } [dependencies] -tauri = { version = "2.10.3", features = [] } +tauri = { version = "2.10.3", features = ["macos-private-api"] } serde = { version = "1.0.228", features = ["derive"] } serde_json = "1.0.149" +window-vibrancy = "0.7.1" [profile.release] opt-level = 3 diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 41900e7..94828d9 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,7 +1,27 @@ +use tauri::Manager; + +#[cfg(target_os = "macos")] +use window_vibrancy::{NSVisualEffectMaterial, apply_vibrancy}; + +#[cfg(target_os = "windows")] +use window_vibrancy::apply_mica; + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .invoke_handler(tauri::generate_handler![]) + .setup(|app| { + let window = app.get_webview_window("main").unwrap(); + + #[cfg(target_os = "macos")] + apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None) + .expect("Unable to apply window blur"); + + #[cfg(target_os = "windows")] + apply_mica(&window, Some(true)).expect("Unable to apply window blur"); + + Ok(()) + }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e6dfd61..9573ca1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -10,12 +10,14 @@ "frontendDist": "../out" }, "app": { + "macOSPrivateApi": true, "withGlobalTauri": true, "windows": [ { "title": "disksense", "width": 800, - "height": 600 + "height": 600, + "transparent": true } ], "security": { @@ -31,6 +33,9 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "macOS": { + "minimumSystemVersion": "13.0" + } } } diff --git a/src/app/globals.css b/src/app/globals.css index f1d8c73..fdbd9c5 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1 +1,6 @@ @import "tailwindcss"; + +html, +body { + @apply bg-transparent; +}