From 5fbfe3fb3603dc9d313ce2381970e21558e0636a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Nov 2019 09:07:20 +0530 Subject: [PATCH] Viewer: Add a shortcut (Ctrl+F11) to toggle the toolbar --- src/pyj/read_book/shortcuts.pyj | 6 ++++++ src/pyj/read_book/view.pyj | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/pyj/read_book/shortcuts.pyj b/src/pyj/read_book/shortcuts.pyj index 8e83e04177..1ba722209d 100644 --- a/src/pyj/read_book/shortcuts.pyj +++ b/src/pyj/read_book/shortcuts.pyj @@ -301,6 +301,12 @@ def add_standalone_viewer_shortcuts(): _('Print book to PDF'), ) + sc['toggle_toolbar'] = desc( + "Ctrl+F11", + 'ui', + _('Toggle the toolbar'), + ) + def create_shortcut_map(custom_shortcuts): ans = {} diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 31de712b7f..486ad4bff1 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -350,6 +350,8 @@ class View: ui_operations.toggle_full_screen() elif data.name is 'toggle_paged_mode': self.toggle_paged_mode() + elif data.name is 'toggle_toolbar': + self.toggle_toolbar() elif data.name is 'quit': ui_operations.quit() elif data.name is 'start_search': @@ -404,6 +406,12 @@ class View: sd.set('read_mode', new_mode) ui_operations.redisplay_book() + def toggle_toolbar(self): + sd = get_session_data() + misc = sd.get('standalone_misc_settings') + misc.show_actions_toolbar = v'!misc.show_actions_toolbar' + sd.set('standalone_misc_settings', misc) + def find(self, text, backwards): self.iframe_wrapper.send_message('find', text=text, backwards=backwards, searched_in_spine=False)