diff --git a/manual/gui.rst b/manual/gui.rst index 1bcf53747c..6d75f65542 100755 --- a/manual/gui.rst +++ b/manual/gui.rst @@ -582,6 +582,10 @@ Calibre has several keyboard shortcuts to save you time and mouse movement. Thes - Open the advanced search dialog * - :kbd:`Esc` - Clear the current search + * - :kbd:`Shift+Esc` + - Focus the book list + * - :kbd:`Ctrl+Esc` + - Clear the virtual library * - :kbd:`N or F3` - Find the next book that matches the current search (only works if the highlight checkbox next to the search bar is checked) * - :kbd:`Shift+N or Shift+F3` diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index fa3f24d63e..8a5f1ffbb5 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -265,6 +265,20 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ action=self.esc_action) self.esc_action.triggered.connect(self.esc) + self.shift_esc_action = QAction(self) + self.addAction(self.shift_esc_action) + self.keyboard.register_shortcut('focus book list', + _('Focus the book list'), default_keys=('Shift+Esc',), + action=self.shift_esc_action) + self.shift_esc_action.triggered.connect(self.shift_esc) + + self.ctrl_esc_action = QAction(self) + self.addAction(self.ctrl_esc_action) + self.keyboard.register_shortcut('clear virtual library', + _('Clear the virtual library'), default_keys=('Ctrl+Esc',), + action=self.ctrl_esc_action) + self.ctrl_esc_action.triggered.connect(self.ctrl_esc) + ####################### Start spare job server ######################## QTimer.singleShot(1000, self.add_spare_server) @@ -377,6 +391,13 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ def esc(self, *args): self.clear_button.click() + def shift_esc(self): + self.current_view().setFocus(Qt.OtherFocusReason) + + def ctrl_esc(self): + self.apply_virtual_library() + self.current_view().setFocus(Qt.OtherFocusReason) + def start_smartdevice(self): message = None if self.device_manager.get_option('smartdevice', 'autostart'):