From 3f153e1423ddfa401bdca17fd97feba135400c2a Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 24 Oct 2023 11:31:11 -0400 Subject: [PATCH] header: Add a keyboard accelerator for toggling the sidebar The user can press ] to open and close the sidebar. Signed-off-by: Anna Schumaker --- emmental/header/__init__.py | 4 +++- tests/header/test_header.py | 2 ++ tests/test_emmental.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/emmental/header/__init__.py b/emmental/header/__init__.py index 1248d0d..b3654c5 100644 --- a/emmental/header/__init__.py +++ b/emmental/header/__init__.py @@ -134,7 +134,9 @@ class Header(Gtk.HeaderBar): ActionEntry("increase-volume", self._volume.increment, "Up"), ActionEntry("toggle-bg-mode", self._background.activate, - "b")] + "b"), + ActionEntry("toggle-sidebar", self._show_sidebar.activate, + "bracketright")] if __debug__: res.append(ActionEntry("edit-settings", self._settings.activate, "s")) diff --git a/tests/header/test_header.py b/tests/header/test_header.py index 1e5c4ac..df51e36 100644 --- a/tests/header/test_header.py +++ b/tests/header/test_header.py @@ -205,6 +205,8 @@ class TestHeader(tests.util.TestCase): "Up"), ("toggle-bg-mode", self.header._background.activate, "b"), + ("toggle-sidebar", self.header._show_sidebar.activate, + "bracketright"), ("edit-settings", self.header._settings.activate, "s")] diff --git a/tests/test_emmental.py b/tests/test_emmental.py index be94256..583dfc7 100644 --- a/tests/test_emmental.py +++ b/tests/test_emmental.py @@ -131,6 +131,7 @@ class TestEmmental(unittest.TestCase): ("app.decrease-volume", "Down"), ("app.increase-volume", "Up"), ("app.toggle-bg-mode", "b"), + ("app.toggle-sidebar", "bracketright"), ("app.edit-settings", "s")]: self.assertEqual(self.application.get_accels_for_action(action), [accel])