From d8d430bf75e6fde6964e7597970ee9e0554424f0 Mon Sep 17 00:00:00 2001 From: Torsten Flammiger Date: Thu, 9 Nov 2023 18:16:50 +0100 Subject: [PATCH] Add keyboard shortcut s to toggle sidebar visibility --- usr/lib/hypnotix/hypnotix.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr/lib/hypnotix/hypnotix.py b/usr/lib/hypnotix/hypnotix.py index a5b1d8f..b835029 100755 --- a/usr/lib/hypnotix/hypnotix.py +++ b/usr/lib/hypnotix/hypnotix.py @@ -140,6 +140,7 @@ def __init__(self, application): self.visible_search_results = 0 self.mpv = None self.ia = IMDb() + self.sidebar_visible = True self.page_is_loading = False # used to ignore signals while we set widget states @@ -1455,6 +1456,13 @@ def close(w, res): def on_menu_quit(self, widget): self.application.quit() + def toggle_sidebar_visibility(self): + self.sidebar_visible = not self.sidebar_visible + if not self.sidebar_visible: + self.sidebar.hide() + else: + self.sidebar.show() + def on_key_press_event(self, widget, event): # Get any active, but not pressed modifiers, like CapsLock and NumLock persistant_modifiers = Gtk.accelerator_get_default_mod_mask() @@ -1480,6 +1488,8 @@ def on_key_press_event(self, widget, event): self.on_prev_channel() elif event.keyval == Gdk.KEY_Right: self.on_next_channel() + elif event.keyval == Gdk.KEY_s: + self.toggle_sidebar_visibility() # elif event.keyval == Gdk.KEY_Up: # # Up of in the list # pass