Skip to main content

tauri_plugin_snap_layout/
desktop.rs

1use tauri::{Runtime, WebviewWindow};
2
3pub struct Snap<R: Runtime> {
4    app: tauri::AppHandle<R>,
5}
6
7impl<R: Runtime> Snap<R> {
8    pub fn new(app: tauri::AppHandle<R>) -> Self {
9        Self { app }
10    }
11
12    pub fn app_handle(&self) -> &tauri::AppHandle<R> {
13        &self.app
14    }
15
16    /// Explicit helper to programmatically force-remove bounds subclassing layout filters if needed.
17    #[allow(unused_variables)]
18    pub fn detach_snap_zone(&self, window: &WebviewWindow<R>) -> crate::Result<()> {
19        #[cfg(windows)]
20        {
21            let version = windows_version::OsVersion::current();
22            if version.build >= 22000 {
23                return crate::platform::snap::uninstall(window);
24            }
25        }
26        Ok(())
27    }
28}