Skip to content

feat(macos): add Dock icon setting and fix Hide behavior#3925

Open
WenJiazhi wants to merge 1 commit into
farion1231:mainfrom
WenJiazhi:codex/window-dock-option
Open

feat(macos): add Dock icon setting and fix Hide behavior#3925
WenJiazhi wants to merge 1 commit into
farion1231:mainfrom
WenJiazhi:codex/window-dock-option

Conversation

@WenJiazhi

Copy link
Copy Markdown

Summary

Add a macOS-only Keep Dock icon setting and restore standard Hide behavior.

CC Switch remains tray-first by default: Keep Dock icon is off unless the user enables it. With either setting, Command+H, the app menu Hide command, and KeyClu-triggered Hide now hide the visible main window instead of only moving it behind other windows.

Root Cause

On macOS, Tauri/Tao's set_dock_visibility(false) path sets NSWindow.canHide = false. That breaks AppKit's standard NSApplication.hide(_:) behavior while the app is in no-Dock/accessory mode.

Changes

  • Add keepDockIcon to settings and expose it as Keep Dock icon on macOS.
  • Compute Dock visibility as mainWindowVisible && keepDockIcon, preserving the default no-Dock tray behavior in background, silent startup, and lightweight mode.
  • Restore NSWindow.canHide = true after applying the Dock policy.
  • Reapply the policy on startup, close-to-tray, reopen, deeplink, lightweight mode transitions, and setting changes.

Related Issue

Fixes #316.

Related context: #67 documents the intentional no-Dock tray behavior.

Screenshots

image

Checklist

  • cargo fmt --check
  • cargo clippy --no-deps
  • TZ=UTC cargo test --lib
  • tsc --noEmit
  • prettier --check "src/**/*.{js,jsx,ts,tsx,css,json}"
  • vitest run
  • vite build
  • User-facing text added to all locale files
  • Manual macOS check: Command+H hides the main window with Keep Dock icon off and on.

@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

隐藏程序不生效

2 participants