diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index d2c25a3e7..294cfa23c 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -58,11 +58,21 @@ impl DesktopContext { let _ = self.proxy.send_event(UserWindowEvent::FocusWindow); } + /// set resizable state + pub fn resizable(&self, resizable: bool) { + let _ = self.proxy.send_event(UserWindowEvent::Resizable(resizable)); + } + /// set window title - pub fn title(&self, title: &str) { + pub fn set_title(&self, title: &str) { let _ = self .proxy - .send_event(UserWindowEvent::Title(String::from(title))); + .send_event(UserWindowEvent::SetTitle(String::from(title))); + } + + /// hide the menu + pub fn hide_menu(&self) { + let _ = self.proxy.send_event(UserWindowEvent::HideMenu); } } diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 6bd95b6ff..452bbba96 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -321,12 +321,25 @@ pub fn launch_with_props( window.set_focus(); } } - UserWindowEvent::Title(content) => { + + UserWindowEvent::SetTitle(content) => { for webview in desktop.webviews.values() { let window = webview.window(); window.set_title(&content); } } + UserWindowEvent::Resizable(state) => { + for webview in desktop.webviews.values() { + let window = webview.window(); + window.set_resizable(state); + } + } + UserWindowEvent::HideMenu => { + for webview in desktop.webviews.values() { + let window = webview.window(); + window.hide_menu(); + } + } } } Event::MainEventsCleared => {} @@ -344,10 +357,12 @@ pub enum UserWindowEvent { DragWindow, CloseWindow, FocusWindow, - - Title(String), Minimize(bool), Maximize(bool), + Resizable(bool), + + SetTitle(String), + HideMenu, } pub struct DesktopController {