1use tauri::{App, Manager};
2
3pub fn set_shadows(app: &mut App, enable: bool) {
4 #[cfg(target_os = "macos")]
5 unsafe {
6 let window = app.get_window("main").unwrap();
7 let ns_window = window.ns_window().unwrap();
8
9 let win = ns_window as *mut objc2_app_kit::NSWindow;
10 (*win).setHasShadow(enable);
11 }
12
13 #[cfg(target_os = "windows")]
14 {
15 use windows_sys::Win32::{
16 Graphics::Dwm::DwmExtendFrameIntoClientArea, UI::Controls::MARGINS,
17 };
18
19 let window = app.get_window("main").unwrap();
20
21 let hwnd = window.hwnd().unwrap().0;
22
23 let m = if enable { 1 } else { 0 };
24 let margins = MARGINS {
25 cxLeftWidth: m,
26 cxRightWidth: m,
27 cyTopHeight: m,
28 cyBottomHeight: m,
29 };
30 unsafe {
31 DwmExtendFrameIntoClientArea(hwnd as _, &margins);
32 };
33 }
34}
35