Skip to content

fix(legacy): show taskbar progress and badge on this app's window - #605

Open
palmoni5 wants to merge 1 commit into
leanflutter:mainfrom
palmoni5:upstream/legacy-taskbar-primary-window
Open

palmoni5 wants to merge 1 commit into
leanflutter:mainfrom
palmoni5:upstream/legacy-taskbar-primary-window

Conversation

@palmoni5

@palmoni5 palmoni5 commented Nov 10, 2026 •

Copy link
Copy Markdown

Problem

setProgressBar and setBadgeLabel of package:window_manager/legacy.dart go through nativeapi's Application, which targets the application's primary window. On Windows, with no primary window set, it falls back to the first window of WindowManager.getAll(), which enumerates visible titled top-level windows without a process filter, so the taskbar progress can land on another application's button.

Change

Both calls first make the addressed window the application's primary window when none is set (Application.getPrimaryWindow() == null). A primary window the app chose itself is left alone.

Test seams: @visibleForTesting debugBindWindow(nativeapi.Window?) and debugApplicationOverride.

Tests

New test/legacy_taskbar_test.dart with a fake window and a fake Application: progress and badge designate the addressed window when there is no primary window, and keep a primary window the app chose.

dart format --set-exit-if-changed ., flutter analyze (package and example) and flutter test (package and example) pass locally (Flutter 3.47.7, Windows), and the full CI workflow passes on the identical commit in my fork.

Related

Part of a set of independent PRs, each based on main and mergeable on its own: widgets #598, #599, #600, #601; legacy bridge #602, #603, #604, #605 (this), #606.

#602 and #604 add the identical debugBindWindow test seam; merges cleanly with all legacy PRs including #606.

setProgressBar and setBadgeLabel go through nativeapi's Application,
which targets the application's primary window. On Windows, with no
primary window set, it falls back to the first window of
WindowManager.getAll(), which enumerates visible titled top-level
windows without a process filter, so the progress could land on another
application's taskbar button.

Both calls now make the addressed window the primary window first when
the app has not chosen one. A primary window the app set itself is left
alone.

Adds @VisibleForTesting debugBindWindow and debugApplicationOverride so
the bridge can be driven by simulated nativeapi objects in tests.
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