Skip to content

Keyboard Shortcuts - #89

Open
AankiMo wants to merge 12 commits into
CravingCrates:mainfrom
AankiMo:shortcuts-v2
Open

Keyboard Shortcuts#89
AankiMo wants to merge 12 commits into
CravingCrates:mainfrom
AankiMo:shortcuts-v2

Conversation

@AankiMo

@AankiMo AankiMo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

introduces configurable global keyboard shortcuts for bulk suggesting and for update decks. slight redesign of settings dialog was necessary

Keyboard Shortcuts:

  • Added support for configurable keyboard shortcuts for "Update Decks" and "Bulk Suggest" actions, including logic to retrieve, display, and register these shortcuts
  • Registered the "Update Decks" shortcut in the main window and the "Bulk Suggest" shortcut in the browser, ensuring shortcuts are only active in the appropriate context
  • context menus and browser actions display the configured shortcut hints

Global Settings Dialog Enhancements:

  • "Keyboard Shortcuts" section, allowing users to set or clear shortcuts for "Update Decks" and "Bulk Suggest" with validation (must use at least two modifier keys)
  • Moved subscription info section

Copilot AI review requested due to automatic review settings July 23, 2026 17:00
@AankiMo AankiMo changed the title biweekly Update Reminder biweekly update Reminder and Keyboard Shortcuts Jul 23, 2026
@AankiMo AankiMo changed the title biweekly update Reminder and Keyboard Shortcuts biweekly update Reminder & Keyboard Shortcuts Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the add-on’s UX by expanding the Global Settings dialog and introducing configurable keyboard shortcuts for “Update Decks” (main window) and “Bulk Suggest” (Browser), including displaying shortcut hints in relevant menus.

Changes:

  • Expanded the Global Settings dialog layout and added a “Keyboard Shortcuts” section with QKeySequenceEdit inputs.
  • Persisted new shortcut settings and surfaced shortcut hints in menu labels.
  • Added Browser menu integration for Bulk Suggest and attempted to register an Update Decks shortcut on the main window.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
plugin_source/menu.py Adds UI for configuring shortcuts, validates/saves shortcut values, and appends a shortcut hint to the Update Decks menu item label.
plugin_source/hooks.py Adds shortcut config helpers, adds a Browser “Bulk suggest notes” action with shortcut, and registers an Update Decks shortcut action.
Comments suppressed due to low confidence (1)

plugin_source/menu.py:1127

  • Shortcut strings are persisted using keySequence.toString() without specifying the format. That will store NativeText on some platforms (e.g. "⌃⌥U" on macOS), which may not round-trip reliably across platforms and also makes downstream parsing/validation harder. Persist in PortableText so hooks.py can parse consistently and UI can still render NativeText for display.
        settings["shortcut_update_decks"] = update_seq.toString() if not update_seq.isEmpty() else ""
        settings["shortcut_bulk_suggest"] = bulk_seq.toString() if not bulk_seq.isEmpty() else ""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin_source/menu.py
Comment thread plugin_source/hooks.py Outdated
Comment thread plugin_source/hooks.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread plugin_source/hooks.py
Comment thread plugin_source/menu.py
save_button = QPushButton('Save Settings')
save_button.setStyleSheet(get_button_style('success'))

def _validate_shortcut(seq: QKeySequence) -> bool:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just brainstorming, but it could be nice to have some kind of collision checks so we don't accidentally overwrite a already-used Shortcut from anki. I can already see the user issue reports in front of me

@AankiMo AankiMo changed the title biweekly update Reminder & Keyboard Shortcuts Keyboard Shortcuts Aug 9, 2026
@AankiMo

AankiMo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

sorry about the mistake with the unwanted commits, should be ok now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants