-
-
Notifications
You must be signed in to change notification settings - Fork 5k
feat(desktop): native tab keyboard shortcuts #5190
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
Conversation
This adds native menu items with keyboard accelerators for tab management ops for the desktop app. These are standard desktop app shortcuts for tab control. The impl creates menu items with platform-appropriate accelerators (Cmd/Ctrl) that emit events to the frontend keybinding module so tab navigation and management can work. Closes HFE-907 Closes #3520 Closes HP-24 \### Shortcuts added - **Ctrl/Cmd+T**: Open new tab - **Ctrl/Cmd+W**: Close current tab - **Ctrl/Cmd+Alt+Left**: Navigate to previous tab - **Ctrl/Cmd+Alt+Right**: Navigate to next tab - **Ctrl/Cmd+0**: Navigate to the first tab - **Ctrl/Cmd+9**: Navigate to the last tab \### Implementation details The architecture uses Tauri's native menu system to register accelerators at the OS level, which then emit `hoppscotch_desktop_shortcut` events to the frontend. This approach makes shortcuts work globally within the app window and follow platform conventions. Global shortcuts would have prevented shortcuts from reaching other apps. The FE keybinding system was extended to support desktop-specific bindings through kernel mode detection, to separate base web shortcuts from desktop-only shortcuts like these. Some additions to tab service: methods like `goToNextTab()`, `goToPreviousTab()`, `goToLastTab()`, `reopenClosedTab()` plus some foundation for future shortcut expansion. \### Notes to reviewers This addresses the UX issue where users would accidentally close the entire app when trying to close tabs with Ctrl/Cmd+W. The shortcuts now match standard desktop application behavior across most browsers and also IDEs to an extent. All existing keyboard shortcuts remain functional. The desktop shortcuts only activate when running in desktop kernel mode, so no changes web app behavior.
b298c12
to
2ea9e93
Compare
2cfc140
to
b26ff05
Compare
"9" -> "(" -> first tab "0" -> ")" -> last tab
There was a problem hiding this comment.
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 adds native desktop tab management keyboard shortcuts to Hoppscotch Desktop, implementing standard accelerator behavior using Tauri’s native menu system and extending the frontend keybinding system to support desktop‐specific actions.
- Implements new menu items for actions like open new tab, close tab, reopen closed tab, and navigation through tabs.
- Extends the tab service and spotlight searcher along with updating keybindings, actions, and locales to support the new desktop shortcuts.
- Minor dependency update (adding @tauri-apps/api) and build tooling changes (cargo-tauri added in devenv.nix).
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/hoppscotch-desktop/src-tauri/src/main.rs | Fixed missing semicolons on early return statements. |
packages/hoppscotch-desktop/src-tauri/src/lib.rs | Added Tauri menu definitions with appropriate accelerators for tab actions. |
packages/hoppscotch-common/src/services/tab/tab.ts | Extended TabService with methods for tab navigation and closed tab history management. |
packages/hoppscotch-common/src/services/tab/index.ts | Updated TypeScript interface to include new tab navigation methods. |
packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts | Added desktop-only actions with related icon imports for tab navigation. |
packages/hoppscotch-common/src/pages/index.vue & graphql.vue | Registered new actions for tab navigation/reopening in the UI. |
packages/hoppscotch-common/src/helpers/keybindings.ts | Integrated desktop-specific keybindings and Tauri event listener for shortcut handling. |
packages/hoppscotch-common/src/helpers/actions.ts | Registered new action identifiers for tab navigation and reopen. |
packages/hoppscotch-common/package.json & locales/en.json | Updated dependencies and locale strings for new shortcut actions. |
devenv.nix | Added cargo-tauri for development environment tooling. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
This adds native menu items with keyboard accelerators for tab management ops for the desktop app. These are standard desktop app shortcuts for tab control.
Closes HFE-907
Closes #3520
Closes HP-24
Shortcuts added
(
, navigate to the left-most tab)
, navigate to the right-most tab9 comes before 0 on QWERTY so it seems more ergonomic.
Implementation details
The impl creates menu items with platform-appropriate accelerators (Cmd/Ctrl) that emit events to the frontend keybinding module so tab navigation and management can work.
The architecture uses Tauri's native menu system to register accelerators at the OS level, which then emit
hoppscotch_desktop_shortcut
events to the frontend.This approach makes shortcuts work globally within the app window and follow platform conventions. Global shortcuts would have prevented shortcuts from reaching other apps (global shortcuts are system level).
The FE keybinding system is extended to support desktop-specific bindings through kernel mode detection, to separate base web shortcuts from desktop-only shortcuts like these (mentioned above).
Some additions to tab service: methods like
goToNextTab()
,goToPreviousTab()
,goToLastTab()
plus some foundation / plumbing for future shortcut expansion.Notes to reviewers
This also addresses the UX issue where users would accidentally close the entire app when trying to close tabs with Ctrl/Cmd+W.
The shortcuts now match standard desktop application behavior across most browsers (firefox, chrome, etc) and also IDEs to an extent (think VS code). The desktop shortcuts only activate when running in desktop kernel mode, so no changes web app behavior.