diff --git a/lazy_player/__init__.py b/lazy_player/__init__.py index a9e6ba9..dc21a23 100644 --- a/lazy_player/__init__.py +++ b/lazy_player/__init__.py @@ -314,6 +314,18 @@ class MainWindow(Gtk.ApplicationWindow): return False + def _on_menu_key_pressed( + self, + keyval: int, + keycode: int, + state: Gdk.ModifierType, + ) -> bool: + if keyval == Gdk.keyval_from_name("q"): + self.close() + return True + + return False + def _on_key_pressed( self, controller: Gtk.EventControllerKey, @@ -321,10 +333,11 @@ class MainWindow(Gtk.ApplicationWindow): keycode: int, state: Gdk.ModifierType, ) -> bool: - # If we're showing video, handle keys differently + # Handle keys differently based on which view is active if self.stack.get_visible_child_name() == "overlay": return self._on_video_key_pressed(keyval, keycode, state) - return False + else: + return self._on_menu_key_pressed(keyval, keycode, state) def _seek_relative(self, offset: int) -> None: """Seek relative to current position by offset seconds"""