Created
November 9, 2025 05:55
-
-
Save 47star/ffec90270067ac4a5a84928ea0e2eabc to your computer and use it in GitHub Desktop.
Enable WebKit hosted blur parameter for Tauri
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "mongja" | |
| version = "0.1.0" | |
| description = "A Tauri App" | |
| authors = ["you"] | |
| edition = "2021" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [lib] | |
| # The `_lib` suffix may seem redundant but it is necessary | |
| # to make the lib name unique and wouldn't conflict with the bin name. | |
| # This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519 | |
| name = "mongja_lib" | |
| crate-type = ["staticlib", "cdylib", "rlib"] | |
| [build-dependencies] | |
| tauri-build = { version = "2", features = [] } | |
| [dependencies] | |
| tauri = { version = "2", features = [] } | |
| tauri-plugin-opener = "2" | |
| serde = { version = "1", features = ["derive"] } | |
| serde_json = "1" | |
| [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] | |
| cocoa = "0.25" | |
| objc = "0.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use tauri::Manager; | |
| #[cfg_attr(mobile, tauri::mobile_entry_point)] | |
| pub fn run() { | |
| tauri::Builder::default() | |
| .setup(|app| { | |
| #[cfg(any(target_os = "macos", target_os = "ios"))] | |
| { | |
| let window = app.get_webview_window("main").unwrap(); | |
| window.with_webview(|webview| { | |
| use cocoa::base::id; | |
| use objc::runtime::Object; | |
| use objc::{msg_send, sel, sel_impl}; | |
| unsafe { | |
| let wkwebview: id = webview.inner().cast(); | |
| let config: id = msg_send![wkwebview, configuration]; | |
| let preferences: id = msg_send![config, preferences]; | |
| let _: () = msg_send![preferences, _setUseSystemAppearance: true]; | |
| } | |
| }).unwrap(); | |
| } | |
| Ok(()) | |
| }) | |
| .plugin(tauri_plugin_opener::init()) | |
| .run(tauri::generate_context!()) | |
| .expect("error while running tauri application"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment