initialization
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
mod setup;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default().setup(setup::init)
|
||||
.invoke_handler(tauri::generate_handler![test_command])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
|
||||
#[tauri::command]
|
||||
async fn test_command() -> String {
|
||||
return String::from("Hello World");
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use tauri::{App, Manager};
|
||||
use window_vibrancy::{self, NSVisualEffectMaterial};
|
||||
|
||||
/// 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)
|
||||
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
|
||||
|
||||
// 仅在 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");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user