Skip to content

feature(macos): show dock icon when config window is open#4628

Open
Mitnitsky wants to merge 1 commit intoflameshot-org:masterfrom
Mitnitsky:vmitnitsky/fix_macos_dock_icon
Open

feature(macos): show dock icon when config window is open#4628
Mitnitsky wants to merge 1 commit intoflameshot-org:masterfrom
Mitnitsky:vmitnitsky/fix_macos_dock_icon

Conversation

@Mitnitsky
Copy link
Copy Markdown
Contributor

@Mitnitsky Mitnitsky commented Apr 7, 2026

Summary

On macOS with LSUIElement=true, Flameshot runs as an agent app with no dock icon. This makes it impossible to Cmd+Tab to open windows or see the app in the dock.

This PR adds a dock icon that appears while any user-facing window is visible and disappears when the last one is closed or hidden.

Supported windows

  • Settings (ConfigWindow)
  • About (InfoWindow)
  • Capture Launcher (CaptureLauncher)
  • Upload History (UploadHistory)

Implementation

  • Flameshot::showDockIcon(QWidget*) — public one-liner for any window. Call after show().
  • Uses QWindow::visibilityChanged signal to track window visibility.
  • Per-window dynamic property (_visibleInDock) prevents double-counting on minimize/maximize transitions.
  • Reference counter toggles NSApplicationActivationPolicy between Regular (dock icon) and Accessory (no dock icon).
  • Adding a new window requires just one line: showDockIcon(myWidget).

Testing

Tested on macOS 26.4 (Tahoe), Apple Silicon, Qt 6.11.0:

  • Open/close each window type — dock icon appears/disappears correctly
  • Multiple windows open — dock icon stays until last one closes
  • CaptureLauncher hide (start capture) + close settings — dock icon disappears
  • Minimize/restore — dock icon persists correctly

@Mitnitsky Mitnitsky changed the title fix(macos): show dock icon when config window is open feature(macos): show dock icon when config window is open Apr 7, 2026
@borgmanJeremy
Copy link
Copy Markdown
Collaborator

Thanks for the very informative link explaining the problem and fix. However this only fixes the config window and not any other window that is spawned. Is there a way to abstract this so other widgets can add a one-liner and get this feature?

@Mitnitsky Mitnitsky force-pushed the vmitnitsky/fix_macos_dock_icon branch from 4d0b3a8 to 38fa920 Compare April 8, 2026 07:14
On macOS with LSUIElement=true, Flameshot runs as an agent app (no dock
icon). This adds a dock icon that appears while any user-facing window
(Settings, About, Launcher, Upload History) is visible and disappears
when the last one is closed or hidden.

Uses QWindow::visibilityChanged signal with a per-window dynamic property
to track visibility state and a reference counter for the activation
policy toggle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Mitnitsky Mitnitsky force-pushed the vmitnitsky/fix_macos_dock_icon branch from 38fa920 to c79d5af Compare April 8, 2026 09:48
@Mitnitsky
Copy link
Copy Markdown
Contributor Author

Thanks for the very informative link explaining the problem and fix. However this only fixes the config window and not any other window that is spawned. Is there a way to abstract this so other widgets can add a one-liner and get this feature?

I've added those changes :)

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