Skip to content

fix(macOS): hide dock icon when closing settings with ⌘+W#9702

Merged
i2h3 merged 1 commit intomasterfrom
i2h3/fix/9328-dock-disappearance
Mar 26, 2026
Merged

fix(macOS): hide dock icon when closing settings with ⌘+W#9702
i2h3 merged 1 commit intomasterfrom
i2h3/fix/9328-dock-disappearance

Conversation

@i2h3
Copy link
Collaborator

@i2h3 i2h3 commented Mar 26, 2026

Summary

Fixes #9328

When the settings window is closed by clicking the window's close button, the macOS dock icon
disappears as expected. However, closing the window with ⌘+W left the dock icon visible.

Root cause

The ForegroundBackground event filter (foregroundbackground_mac.mm) listens for QEvent::Close
to call ToBackground(), which hides the dock icon.

  • Close button: Qt sends QEvent::Close β†’ event filter fires β†’ dock icon hides.
  • ⌘+W shortcut: Was connected to SettingsDialog::accept(), which calls QDialog::done() β†’
    hide() β†’ emits QEvent::Hide, not QEvent::Close. The event filter never fires.

Fix

Connect the ⌘+W shortcut to close() instead of accept(). QWidget::close() sends a
QEvent::Close, which:

  1. Triggers the ForegroundBackground event filter β†’ hides the dock icon
  2. Invokes SettingsDialog::reject() (QDialog's default close behavior) β†’ saves window geometry
  3. Deletes the dialog via WA_DeleteOnClose

This matches the close button's behavior exactly.

@i2h3 i2h3 added this to the 33.0.1 milestone Mar 26, 2026
@i2h3 i2h3 self-assigned this Mar 26, 2026
@i2h3 i2h3 added the bug label Mar 26, 2026
@i2h3 i2h3 requested a review from nilsding as a code owner March 26, 2026 08:57
@i2h3 i2h3 added os: 🍎 macOS Apple macOS, formerly also known as OS X feature: ☁️ GUI System tray icon and menu. labels Mar 26, 2026
@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in πŸ’» Desktop Clients team Mar 26, 2026
@i2h3
Copy link
Collaborator Author

i2h3 commented Mar 26, 2026

/backport to stable-33.0

The ⌘+W shortcut was connected to QDialog::accept(), which internally
calls hide() and emits QEvent::Hide. The ForegroundBackground event
filter only listens for QEvent::Close, so the dock icon remained visible.

Clicking the window's close button works correctly because it sends
QEvent::Close directly.

Connecting the shortcut to close() instead of accept() ensures
QEvent::Close is sent, making ⌘+W behave identically to the close
button: the event filter fires, ToBackground() is called, and the dock
icon disappears.

Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
@i2h3 i2h3 force-pushed the i2h3/fix/9328-dock-disappearance branch from 1a65d8a to 30b7fbf Compare March 26, 2026 11:45
@github-actions
Copy link

Artifact containing the AppImage: nextcloud-appimage-pr-9702.zip

Digest: sha256:4a0916dadef1deee2124aed9d71ebed08c86fd1e65ff780dc581236bc44f1662

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@i2h3 i2h3 merged commit b163e34 into master Mar 26, 2026
19 of 20 checks passed
@i2h3 i2h3 deleted the i2h3/fix/9328-dock-disappearance branch March 26, 2026 12:15
@github-project-automation github-project-automation bot moved this from 🧭 Planning evaluation (don't pick) to β˜‘οΈ Done in πŸ’» Desktop Clients team Mar 26, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Maintainability Rating on New Code (required β‰₯ A)
31 New Code Smells (required ≀ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug feature: ☁️ GUI System tray icon and menu. os: 🍎 macOS Apple macOS, formerly also known as OS X

Projects

Status: β˜‘οΈ Done

Development

Successfully merging this pull request may close these issues.

Dock icon persists after closing settings window with ⌘+W

1 participant