8000 feat(desktop): native tab keyboard shortcuts by CuriousCorrelation · Pull Request #5190 · hoppscotch/hoppscotch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 5 commits into from
Jun 24, 2025

Conversation

CuriousCorrelation
Copy link
Member
@CuriousCorrelation CuriousCorrelation commented Jun 24, 2025

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

  • 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+9: Corresponds to (, navigate to the left-most tab
  • Ctrl/Cmd+0: Corresponds to ), navigate to the right-most tab

9 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.

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.
@CuriousCorrelation CuriousCorrelation force-pushed the feat-desktop-common-keyboard-shortcuts branch from b298c12 to 2ea9e93 Compare June 24, 2025 06:24
Copilot

This comment was marked as outdated.

Copilot

This comment was marked as outdated.

@CuriousCorrelation CuriousCorrelation force-pushed the feat-desktop-common-keyboard-shortcuts branch from 2cfc140 to b26ff05 Compare June 24, 2025 06:30
Copilot

This comment was marked as outdated.

"9" -> "(" -> first tab
"0" -> ")" -> last tab
Copilot

This comment was marked as outdated.

Copy link
@Copilot Copilot AI left a 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

@CuriousCorrelation CuriousCorrelation marked this pull request as ready for review June 24, 2025 10:43
@jamesgeorge007 jamesgeorge007 merged commit 78e623a into next Jun 24, 2025
1 check passed
@jamesgeorge007 jamesgeorge007 deleted the feat-desktop-common-keyboard-shortcuts branch June 24, 2025 17:46
@CuriousCorrelation CuriousCorrelation linked an issue Jun 26, 2025 that may be closed by this pull request
1 task
javi2754 pushed a commit to javi2754/hoppscotch that referenced this pull request Jun 26, 2025
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.

[feature]: Add tab-specific keyboard shortcuts in Desktop app
3 participants
0