diff --git a/.gitignore b/.gitignore index 0592392..e747356 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target .DS_Store +/.vscode diff --git a/src/config/autostart.rs b/src/config/autostart.rs index f381d90..458ad99 100644 --- a/src/config/autostart.rs +++ b/src/config/autostart.rs @@ -86,7 +86,6 @@ impl AutoStartManager { } /// Check if auto-start is currently enabled - #[allow(dead_code)] pub fn is_enabled(&self) -> Result { self.auto_launch .is_enabled() @@ -98,10 +97,15 @@ impl AutoStartManager { /// # Arguments /// * `enabled` - Whether auto-start should be enabled pub fn sync_state(&self, enabled: bool) -> Result<(), AutoStartError> { - if enabled { - self.enable() + let current_enabled = self.is_enabled().unwrap_or(false); + if current_enabled != enabled { + if enabled { + self.enable() + } else { + self.disable() + } } else { - self.disable() + Ok(()) } } } diff --git a/src/gui/board/actions.rs b/src/gui/board/actions.rs index 26c68e7..a42b0a0 100644 --- a/src/gui/board/actions.rs +++ b/src/gui/board/actions.rs @@ -44,6 +44,20 @@ impl RopyBoard { } pub fn on_hide_action(&mut self, _: &Hide, window: &mut Window, cx: &mut Context) { + // If still in settings, exit settings view and refocus main board instead of hiding + if self.show_settings { + self.show_settings = false; + self.settings_max_history_input.update(cx, |input, cx| { + input.set_value("", window, cx); + }); + self.settings_activation_key_input.update(cx, |input, cx| { + input.set_value("", window, cx); + }); + window.focus(&self.focus_handle); + cx.notify(); + return; + } + // If the search input is focused, return focus to the main component before hiding if let Some(focused_handle) = window.focused(cx) && focused_handle == self.search_input.focus_handle(cx)