Skip to content

fix(wework): restore macOS dock window lifecycle - #1928

Merged
qdaxb merged 1 commit into
mainfrom
fix/wework-macos-dock-reopen
Jul 13, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/wework-macos-dock-reopen

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • use Tauri's dedicated macOS Dock visibility API for close-to-tray lifecycle changes
  • reopen and focus the main window when macOS sends RunEvent::Reopen without visible windows
  • avoid redundant Dock visibility transitions and remove the obsolete native icon cache
  • add an isolated close-to-tray AI verification action and document its usage

Root cause

The close-to-tray path destroyed the main window and changed NSApplication activation policy. On older macOS versions that policy transition could leave the Dock icon visible. The application also did not handle the native reopen callback, so activating the remaining Dock icon could not recreate the destroyed main window.

Impact

Closing Wework to the tray now removes its Dock icon while keeping the process running. If macOS still delivers a Dock/system reopen activation, Wework recreates and focuses the main window instead of leaving an unresponsive icon.

Validation

  • cargo fmt --check
  • cargo check
  • cargo test — 44 passed
  • Prettier and ESLint checks for the changed verification files
  • pnpm --filter wework typecheck
  • pre-push Wework ESLint, TypeScript, and unit-test suite
  • isolated real-Tauri verification: closing to tray left the process running, reduced visible app windows to zero, and changed the macOS application type to UIElement; subsequent native activation initialized a new WebView

The real-Tauri run used macOS 26.2. Dedicated older-macOS hardware was not available in this workspace.

Summary by CodeRabbit

  • New Features

    • Added a verification command action to close the main window to the system tray.
    • On macOS, reopening the app from the Dock now restores the main window when no windows are visible.
  • Bug Fixes

    • Improved macOS Dock icon visibility tracking and recovery to better handle failures when toggling visibility.
  • Tests

    • Added an end-to-end desktop control action to close the main window to the system tray.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b553d075-ba98-486d-9a4d-43ed96beeb9e

📥 Commits

Reviewing files that changed from the base of the PR and between 56b5300 and 996c57f.

📒 Files selected for processing (5)
  • wework/AGENTS.md
  • wework/scripts/ai-verify.mjs
  • wework/src-tauri/Cargo.toml
  • wework/src-tauri/src/lib.rs
  • wework/src/e2e/automation.ts

📝 Walkthrough

Walkthrough

Adds a close-to-tray desktop verification command, wires it through E2E automation, narrows macOS AppKit features, and updates Dock visibility and main-window reopening behavior.

Changes

Close-to-tray verification

Layer / File(s) Summary
Desktop control command wiring
wework/scripts/ai-verify.mjs, wework/src/e2e/automation.ts, wework/AGENTS.md
Adds the close-to-tray CLI action, dispatches closeMainWindowToTray, applies body-selector behavior, and documents the verification command.
macOS Dock and reopen lifecycle
wework/src-tauri/Cargo.toml, wework/src-tauri/src/lib.rs
Narrows macOS AppKit features, tracks Dock visibility in lifecycle state, removes Dock icon caching, and restores the main window on RunEvent::Reopen when no windows are visible.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AIVerifyCLI
  participant E2EAutomation
  participant TauriRuntime
  participant macOS
  AIVerifyCLI->>E2EAutomation: dispatch close-to-tray
  E2EAutomation->>TauriRuntime: invoke closeMainWindowToTray
  TauriRuntime->>macOS: hide Dock icon and close WebView
  macOS->>TauriRuntime: emit Reopen
  TauriRuntime->>TauriRuntime: ensure main window
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: fixing macOS Dock and window lifecycle behavior for Wework.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-macos-dock-reopen

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.

@qdaxb
qdaxb marked this pull request as ready for review July 13, 2026 13:47
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.

1 participant