diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index e9879a736a..14198bf5a7 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -210,6 +210,8 @@ class EbookViewer(MainWindow): m.addSeparator() a(_('Start of current file'), 'start_of_file') a(_('End of current file'), 'end_of_file') + m.addSeparator() + a(_('Hide this scrollbar'), 'toggle_scrollbar') q = m.exec_(QCursor.pos()) if not q: diff --git a/src/pyj/read_book/shortcuts.pyj b/src/pyj/read_book/shortcuts.pyj index 7345b359f9..8c69a0aece 100644 --- a/src/pyj/read_book/shortcuts.pyj +++ b/src/pyj/read_book/shortcuts.pyj @@ -228,6 +228,12 @@ def shortcuts_definition(): _('Toggle between Paged mode and Flow mode for text layout') ), + 'toggle_scrollbar': desc( + 'Ctrl+w', + 'ui', + _('Toggle the scrollbar') + ), + 'toggle_reference_mode': desc( 'Ctrl+x', 'ui', diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 087defc5ac..01918d668e 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -269,6 +269,15 @@ class View: def reference_mode_overlay(self): return document.getElementById('reference-mode-overlay') + def set_scrollbar_visibility(self, visible): + sd = get_session_data() + sd.set('book_scrollbar', bool(visible)) + self.book_scrollbar.apply_visibility() + + def toggle_scrollbar(self): + sd = get_session_data() + self.set_scrollbar_visibility(not sd.get('book_scrollbar')) + def on_lookup_word(self, data): if runtime.is_standalone_viewer: ui_operations.selection_changed(data.word) @@ -388,6 +397,8 @@ class View: self.toggle_paged_mode() elif data.name is 'toggle_toolbar': self.toggle_toolbar() + elif data.name is 'toggle_scrollbar': + self.toggle_scrollbar() elif data.name is 'quit': ui_operations.quit() elif data.name is 'start_search':