From 2ab38b43ab3f09ff7b415dfc04eb89c44e8211c2 Mon Sep 17 00:00:00 2001 From: Ano-sys Date: Thu, 11 Jun 2026 23:24:35 +0200 Subject: [PATCH] Added enter key as a way to invoke the current focused FlowBoxChild clicked event (copy emoji to clip) - added c key event to return to category bar when arrow navigating through FlowBox - window is terminated with exit(0) with method _close_window now, previously it was just hide --- glyph/main.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/glyph/main.py b/glyph/main.py index 0edd831..286e850 100644 --- a/glyph/main.py +++ b/glyph/main.py @@ -65,6 +65,9 @@ def _on_close_request(self, *_): self.set_visible(False) return True + def _close_window(self): + exit(0) + def _hide_window(self): self.set_visible(False) @@ -174,15 +177,23 @@ def _on_key_pressed(self, controller, keyval, keycode, state): self._focus_search() return True - if keyval != Gdk.KEY_Escape: - return False + if keyval == Gdk.KEY_Escape: + if self.get_focus() is self.search: + self.set_focus(None) + else: + self._close_window() + return True - if self.get_focus() is self.search: - self.set_focus(None) + if keyval == Gdk.KEY_Return: + focused_widget = self.get_focus() + if isinstance(focused_widget, Gtk.FlowBoxChild): + focused_widget.get_child().emit("clicked") + + if keyval == Gdk.KEY_c: + self.char_view.category_buttons[None].grab_focus() return True - self._hide_window() - return True + return False class MyApp(Adw.Application):