Skip to content

fix(macos): focus the last-used workspace on Dock activation - #889

Merged
xintaofei merged 5 commits into
spacering-net:mainfrom
ker2xu:fix/macos-dock-workspace-activation
Oct 9, 2026
Merged

xintaofei merged 5 commits into
spacering-net:mainfrom
ker2xu:fix/macos-dock-workspace-activation

Conversation

@ker2xu

@ker2xu ker2xu commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Clicking the macOS Dock icon always brought forward the local main window, even when a remote workspace was the most recently used window. This could reveal the hidden local workspace while leaving the intended remote window minimized.

  • Route the native Reopen event through workspace activation.
  • Select the most recently used existing workspace, ignoring auxiliary windows and a local window that was explicitly closed to the tray.
  • Unminimize, show and focus the selected workspace using the existing shared window helper.
  • Fall back to local when no workspace remains, and wait when a remote-only restoration is still pending.

Validation

  • Three activation regressions cover MRU selection, the hidden-local case and activation during remote-only restoration.
  • The standalone Dock branch passed all 21 workspace model/database tests.
  • Rust clippy passed for all targets with test-utils and warnings treated as errors.
  • Native macOS Reopen through LaunchServices, remote minimize/restore and MRU focus were verified on the combined workspace fixes. A physical Dock-icon click has not been exercised.
  • GitHub Test workflow concluded action_required with zero jobs executed; CI validation is pending.

Related work

Overlaps with the workspace-activation portion of #887. Companion changes: remote restoration and recovery and the local-workspace entry.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 07:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation matches the stated behavior and covers the key selection edge cases with tests.

0 open findings

What changed in this PR

Routes macOS Dock activation to the most recently used workspace instead of always opening the local window.

Changes:

  • Selects the latest existing workspace while respecting restoration state.
  • Reuses shared unminimize/show/focus behavior.
  • Adds regression tests for MRU, hidden-local, and restoration cases.
File Description
src-tauri/​src/​lib.rs Routes macOS Reopen events through workspace activation.
src-tauri/​src/​commands/​workspace_windows.rs Implements activation selection and tests.
src-tauri/​src/​commands/​windows.rs Exposes the shared focus helper internally.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

xintaofei and others added 3 commits October 9, 2026 08:33
The setup comment claimed only the tray and explicit local-workspace
actions bring a hidden `main` back, but a second launch and a
`codeg://` link still do, and the Dock does once no other workspace is
open or on its way back. The shared show-and-focus helper still routed
Dock activation through `show_main_window`.

The Reopen arm also lost the reason it ignores `has_visible_windows`:
any auxiliary window makes it true while every workspace is hidden or
minimized.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dock activation waits while a remote-only restore still has windows
pending, and falls back to local once none are. No test covered the
second half: narrowing the condition to `!restoring` passed every
activation test. Closing the restored window before the restore
finishes now has to reach the local workspace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`activate_workspace` said local is never shown while a remote-only
launch is restoring. It is, once nothing is left pending; only windows
still to be brought back make it wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xintaofei

Copy link
Copy Markdown
Collaborator

codeg work task 290 is done — #889 (3 files, +20/-8).

@xintaofei
xintaofei merged commit 3f29f4a into spacering-net:main Oct 9, 2026
7 checks passed
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