From 1550c2060e2c0f506ff9931a3fbad3fb5877e1b5 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 12 Sep 2024 21:04:27 +0200
Subject: [PATCH] In browser.py, allow activating sort order by hitting Return.

---
 browser.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/browser.py b/browser.py
index c8f4bf8..7639a0f 100755
--- a/browser.py
+++ b/browser.py
@@ -281,7 +281,8 @@ class MainWindow(Gtk.Window):
         viewer.append(self.navbar)
         viewer.append(init_gallery_widgets())
         self.side_box = Gtk.Box(orientation=OR_V)
-        self.side_box.append(init_sorter_and_filterer())
+        self.sort_box = init_sorter_and_filterer()
+        self.side_box.append(self.sort_box)
         self.side_box.append(init_metadata_box())
         box_outer = Gtk.Box(orientation=OR_H)
         box_outer.append(self.side_box)
@@ -730,7 +731,10 @@ class MainWindow(Gtk.Window):
         """Handle keys if not in Entry, return True if key handling done."""
         if isinstance(self.get_focus().get_parent(), Gtk.Entry):
             return False
-        if Gdk.KEY_G == keyval:
+        if Gdk.KEY_Return == keyval and\
+                self.get_focus().get_parent().get_parent() == self.sort_box:
+            self.activate_sort_order()
+        elif Gdk.KEY_G == keyval:
             self.move_selection_in_gallery(None, None, 1)
         elif Gdk.KEY_h == keyval:
             self.move_selection_in_gallery(-1, None, None)
-- 
2.30.2