Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add keyboard shortcut s to toggle sidebar visibility #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions usr/lib/hypnotix/hypnotix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down