Skip to content

Navigate workspace history with the mouse side buttons - #25555

Closed
AlexThunder1989 wants to merge 3 commits into
stablyai:mainfrom
AlexThunder1989:mouse-side-button-history
Closed

AlexThunder1989 wants to merge 3 commits into
stablyai:mainfrom
AlexThunder1989:mouse-side-button-history

Conversation

@AlexThunder1989

@AlexThunder1989 AlexThunder1989 commented Oct 5, 2026 •

Copy link
Copy Markdown

Binds the mouse back/forward buttons to the same function the existing keyboard shortcut already uses for switching workspaces. Over a web view, local or remote, they go back/forward in that page instead.

Minimal for Linux and Windows and does the job well. macOS swipes (trackpad and Logitech Options+) are handled standalone in #25592.

Input Arrives in Orca as Handled by
Side buttons on Linux / Windows Mouse button 3 / 4 #25555
Side buttons on macOS, mouse without vendor software Mouse button 3 / 4 #25555
Logitech Options+ back/forward on macOS Swipe between pages #25592
Trackpad page swipe on macOS Swipe between pages #25592
Pointer over Mouse buttons (#25555) Swipe (#25592)
A web page Page back/forward Page back/forward
A remote (streamed) web page Remote page back/forward Remote page back/forward (with #25555)
Anywhere else Workspace back/forward Workspace back/forward

Workspace history is the same one the existing keyboard shortcut uses (⌘⌥←/→ on macOS, Ctrl+Alt+←/→ on Linux/Windows). The two PRs share no code and can merge in either order.

EDIT: Side buttons over a remote (streamed) web page now go back/forward in that page instead of switching workspace (0691180).

ELI5

The mouse back/forward buttons now switch workspaces, just like the existing keyboard shortcut. Over a web page they go back/forward in that page instead.

What Changed

A window mouseup listener sends buttons 3/4 to the existing workspace back/forward handler. Inside a local web page, the script Orca already injects calls history.go. Over a remote web page, the pane runs the same remote back/forward the keyboard shortcut uses and cancels the press, so the workspace doesn't switch.

Why

Each input is handled where it arrives and reuses existing navigation; no new state or settings.

Linked Issue

Fixes #25633

Related: #25592, #23255

Visual Proof

N/A — no UI change; existing workspace navigation gets a second input.

Testing

  • I manually tested these changes locally (Linux): local web page, workspace switching, and a remote web page from Linux to a headless Linux host
  • Automated tests added/updated, or explained why not below

Test N/A: short code; a broken case is instantly visible.

AI Disclosure

Claude Opus 5.5 (Claude Code).

Review

N/A

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

N/A — renderer-only input listener; no SSH, mobile, security, performance or compatibility impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 042634da-f807-4350-a45a-62dde27f98ee
📥 Commits

Reviewing files that changed from the base of the PR and between bb92170 and 0691180.

📒 Files selected for processing (1)
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The worktree IPC listener and capture-phase mouseup listener now use a shared handler for history navigation. The handler checks that the active view is terminal and dispatches back or forward navigation. Mouse buttons 3 and 4 map to back and forward. The browser link-routing listener handles trusted, unprevented mouseup events for those buttons by navigating browser history. The remote browser pane routes pointer buttons 3 and 4 to back and forward navigation.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 06911

Linux users could skip an extra history entry when using mouse Back or Forward if native traversal also occurs. The exact runtime behavior remains uncertain, so this is a bounded follow-up risk.

Architecture Summary

Architecture risk: 🔵 Low · up to bb921

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts: The inline IPC callback is replaced by navigateWorktreeHistory, which retains the terminal-view guard and back-versus-forward dispatch; the shared handler is registered as the IPC listener.
  • observed — Modified behavior in src/renderer/src/hooks/ipc-events/workspace-shortcut-ipc-bridge.ts: Adds a capture-phase mouseup listener that routes side-button 3 to back and button 4 to forward through the shared handler, and registers its removal in unsubs.
  • observed — Modified behavior in src/main/browser/browser-clicked-link-routing.ts: Adds a mouseup listener that navigates back or forward for trusted, unprevented events with button 3 or 4, respectively.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: using mouse side buttons to navigate workspace history.
Description check ✅ Passed The description covers the required sections, explains the user-facing change and implementation, links the issue, provides a reason for omitting visual proof and automated tests, and reports manual t…
  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16adb0f9-a3a0-462b-8538-bb788a52765a
📥 Commits

Reviewing files that changed from the base of the PR and between 87f9729 and bb92170.

📒 Files selected for processing (1)
  • src/main/browser/browser-clicked-link-routing.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Reviewed the macOS swipe commit (4a11cd9) added since the prior review of bb92170. That commit touches only src/main/window/createMainWindow.ts.

  • Added a macOS trackpad swipe listener that routes a horizontal swipe to the hovered browser guest's history (navigationHistory.goToOffset) and otherwise forwards ui:worktreeHistoryNavigate to the renderer for workspace history.

I verified the direction === 'left' → back mapping against the pinned Electron 43.7.5 source (event.deltaX == 1.0 → "left"), Apple's NSEvent.deltaX convention, and the established Electron/macOS back-gesture implementations; it is not inverted, and the mouse side-button path reuses the same navigate function as the keyboard shortcut.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Re-reviewed after the branch was force-pushed back to bb92170.

  • Removed the macOS trackpad swipe handler from src/main/window/createMainWindow.ts (and its webContents import); that work now lives in #25592, matching the updated PR description.

No other files changed since the prior review; the side-button handling in browser-clicked-link-routing.ts and workspace-shortcut-ipc-bridge.ts is unchanged.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Re-reviewed the commit added since the prior pullfrog review of bb92170. 0691180 touches one file.

  • Routed mouse side buttons (button 3 = back, 4 = forward) inside remote browser panes to the pane's own page history: remote-browser-page-pane.tsx:425 now wraps the handleRemotePointerDown passed to RemoteBrowserPageViewport, calls event.preventDefault() for buttons 3/4, and issues runRemoteNavigation('browser.back' | 'browser.forward') instead of forwarding a mouse-down to the guest.

The load-bearing claim in the inline comment checks out: canceling pointerdown sets the PREVENT MOUSE EVENT flag for the pointer type (Pointer Events spec, "Mapping for devices that support hover"), which suppresses the subsequent compatibility mouseup for that pointer, so the capture-phase window mouseup listener in workspace-shortcut-ipc-bridge.ts will not also switch workspace history. The untouched handleRemotePointerUp is harmless here because getRemoteBrowserMouseButton returns null for buttons 3/4 and the handler early-returns.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@AlexThunder1989

Copy link
Copy Markdown
Author

Latest commit (0691180) also covers remote (streamed) browser panes: the side buttons now go back/forward in the remote page instead of switching workspace. Tested on Linux with a remote project.

@AlexThunder1989
AlexThunder1989 force-pushed the mouse-side-button-history branch from 3af118b to 0691180 Compare October 5, 2026 17:24

@pullfrog pullfrog Bot 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.

ℹ️ No critical issues — one minor test-isolation suggestion inline.

Reviewed changes

Re-reviewed the commit added since the prior pullfrog review of 0691180. 3af118b adds tests for the side-button paths and makes one supporting change to the local-guest routing guard.

  • Added side-button tests for the workspace shortcut bridge (buttons 3/4 walk worktree history; other buttons and non-terminal views are ignored).
  • Added side-button tests for the local browser guest (history.go(-1|1) on buttons 3/4, page cancellation honored) and for the remote pane (side buttons route to remote browser.back/browser.forward and suppress the workspace switch; ordinary pointer-downs still forward).
  • Widened the guest mouseup guard from event.isTrusted to event.isTrusted || state.allowUntrustedEvents, mirroring the existing click listener so synthetic test events reach the handler. Production emits three arguments from buildBrowserClickedLinkRoutingScript, so allowUntrustedEvents stays false and the guard change is a no-op outside tests.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Re-reviewed after the branch was force-pushed back to 0691180 while the previous review was in flight. The test commit (3af118b) was removed, leaving the three production files already reviewed in pullfrog review #5416220297; the inline test-isolation note raised against that transient test file was withdrawn and its thread resolved, since the file no longer exists.

  • Removed the side-button test additions and the accompanying allowUntrustedEvents guard widening; browser-clicked-link-routing.ts is back to the event.isTrusted-only guard.
  • remote-browser-page-pane.tsx and workspace-shortcut-ipc-bridge.ts are unchanged from the previously approved revision.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@AlexThunder1989

Copy link
Copy Markdown
Author

Closing: the browser-page part is already implemented upstream in #31859, and the rest (side buttons over Orca's own UI step workspace history) continues in #34463, rebuilt on current main.

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]: Mouse back/forward buttons and macOS swipe should navigate workspaces and browser pages

1 participant