[PR #5190] [MERGED] feat(desktop): native tab keyboard shortcuts #5096

Closed
opened 2026-03-17 02:34:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5190
Author: @CuriousCorrelation
Created: 6/24/2025
Status: Merged
Merged: 6/24/2025
Merged by: @jamesgeorge007

Base: nextHead: feat-desktop-common-keyboard-shortcuts


📝 Commits (5)

  • 2ea9e93 feat(desktop): native tab keyboard shortcuts
  • b26ff05 fix(desktop): missing tab_first menu item
  • a662ce9 fix(desktop): more ergonomic first/last tab binds
  • 9f9c40b feat(desktop): add new tab shortcuts to spotlight
  • 4582f4a fix(desktop); log error as console.error

📊 Changes

13 files changed (+426 additions, -15 deletions)

View changed files

📝 devenv.nix (+1 -0)
📝 packages/hoppscotch-common/locales/en.json (+4 -0)
📝 packages/hoppscotch-common/package.json (+1 -0)
📝 packages/hoppscotch-common/src/helpers/actions.ts (+5 -0)
📝 packages/hoppscotch-common/src/helpers/keybindings.ts (+79 -4)
📝 packages/hoppscotch-common/src/pages/graphql.vue (+23 -0)
📝 packages/hoppscotch-common/src/pages/index.vue (+24 -0)
📝 packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts (+44 -0)
📝 packages/hoppscotch-common/src/services/tab/index.ts (+33 -0)
📝 packages/hoppscotch-common/src/services/tab/tab.ts (+66 -1)
📝 packages/hoppscotch-desktop/src-tauri/src/lib.rs (+139 -1)
📝 packages/hoppscotch-desktop/src-tauri/src/main.rs (+2 -2)
📝 pnpm-lock.yaml (+5 -7)

📄 Description

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 issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5190 **Author:** [@CuriousCorrelation](https://github.com/CuriousCorrelation) **Created:** 6/24/2025 **Status:** ✅ Merged **Merged:** 6/24/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `feat-desktop-common-keyboard-shortcuts` --- ### 📝 Commits (5) - [`2ea9e93`](https://github.com/hoppscotch/hoppscotch/commit/2ea9e93c91360950ade4c5333d0cc15b165282d9) feat(desktop): native tab keyboard shortcuts - [`b26ff05`](https://github.com/hoppscotch/hoppscotch/commit/b26ff05e69f2d5b6ffb6b2da903eac14c9a21584) fix(desktop): missing `tab_first` menu item - [`a662ce9`](https://github.com/hoppscotch/hoppscotch/commit/a662ce90c8723984fd809790c8b8ed821ab316f6) fix(desktop): more ergonomic first/last tab binds - [`9f9c40b`](https://github.com/hoppscotch/hoppscotch/commit/9f9c40bd091ec57527b55142b9577c3dc01fbb67) feat(desktop): add new tab shortcuts to spotlight - [`4582f4a`](https://github.com/hoppscotch/hoppscotch/commit/4582f4a59d9d743d7984b64c0c1558571f12e90b) fix(desktop); log error as `console.error` ### 📊 Changes **13 files changed** (+426 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `devenv.nix` (+1 -0) 📝 `packages/hoppscotch-common/locales/en.json` (+4 -0) 📝 `packages/hoppscotch-common/package.json` (+1 -0) 📝 `packages/hoppscotch-common/src/helpers/actions.ts` (+5 -0) 📝 `packages/hoppscotch-common/src/helpers/keybindings.ts` (+79 -4) 📝 `packages/hoppscotch-common/src/pages/graphql.vue` (+23 -0) 📝 `packages/hoppscotch-common/src/pages/index.vue` (+24 -0) 📝 `packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts` (+44 -0) 📝 `packages/hoppscotch-common/src/services/tab/index.ts` (+33 -0) 📝 `packages/hoppscotch-common/src/services/tab/tab.ts` (+66 -1) 📝 `packages/hoppscotch-desktop/src-tauri/src/lib.rs` (+139 -1) 📝 `packages/hoppscotch-desktop/src-tauri/src/main.rs` (+2 -2) 📝 `pnpm-lock.yaml` (+5 -7) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:34:38 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5096
No description provided.