Skip to content

Fix Window.skip_task_bar not hiding the app from the taskbar on Windows - #6946

Open
ndonkoHenri wants to merge 5 commits into
flet-1.1.0from
fix/windows-skip-taskbar-6302
Open

ndonkoHenri wants to merge 5 commits into
flet-1.1.0from
fix/windows-skip-taskbar-6302

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6302

The bug

On Windows, page.window.skip_task_bar = True left the taskbar button in place.

The window service caches the window's state when it starts and applies a property only when the requested value differs from the cached one. On Windows, window_manager's isSkipTaskbar() doesn't ask the OS. It returns an internal flag that starts out true (bool is_skip_taskbar_ = true; in window_manager.cpp) and that only setSkipTaskbar() updates, even though a new window has a taskbar button. So the cache said the window was already hidden from the taskbar, True looked unchanged, and setSkipTaskbar(true) was never called. Setting False and then True worked, which made it look random. macOS and Linux report a real starting value and weren't affected.

The fix

  • On Windows, getWindowState() reports the value Flet last applied through setWindowSkipTaskBar() instead of window_manager's flag. macOS and Linux are unchanged.
  • That value starts as unknown (null) rather than false. A Flutter hot restart resets Dart state while the native window keeps its taskbar state, so the first requested value is always applied. WindowState.skipTaskBar is now bool?.
  • Window.skip_task_bar's docstring now notes that on Windows 11 the window is also hidden from Alt+Tab. window_manager removes the taskbar tab, which also drops the window from Alt+Tab there, so a window minimized while hidden can only be restored by the app itself.

Testing

  • Windows 11 ARM64 VM, real desktop client:
    • Before the fix, skip_task_bar=True set in main() left the taskbar button in place; with it, the button is gone from the start.
    • Toggling the property afterwards follows each change.
    • Hiding/showing and minimizing/restoring the window keeps it off the taskbar.
  • Widget test (not part of this PR): it drives WindowService with a mocked window_manager channel that reports true before any set, as on Windows. Its Windows startup cases fail on flet-1.1.0 and pass with this change; 8 of 8 cases pass.
  • Other checks: the packages/flet suite passes, and flutter analyze shows no new issues.

Summary by Sourcery

Ensure Windows taskbar visibility is correctly applied and documented for hidden windows.

Bug Fixes:

  • Fix Window.skip_task_bar = True so Windows desktop windows are reliably hidden from the taskbar, including on initial startup and after Flutter hot restart.

Enhancements:

  • Track the last Windows taskbar visibility value as unknown until applied, ensuring the requested state is always synchronized with the native window.
  • Document that hiding a window from the taskbar on Windows 11 also removes it from Alt+Tab and requires an app-controlled restore path.

window_manager's isSkipTaskbar() starts out true on Windows, so the
cached window state already said the window was hidden from the taskbar
and setting skip_task_bar to True was skipped. Track the value Flet last
applied instead.
The value Flet last applied lives in the Dart isolate, which a Flutter
hot restart resets while the native window keeps its taskbar state.
Start from unknown instead of false, so the first requested value is
always applied.
window_manager hides the taskbar button with ITaskbarList::DeleteTab, which on Windows 11 also drops the window from Alt+Tab, so a window minimized while hidden has no way back unless the app provides one.
@ndonkoHenri
ndonkoHenri requested review from FeodorFitsner and a balanced review from Copilot October 10, 2026 18:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b4d1fd
Status: ✅  Deploy successful!
Preview URL: https://2322ef48.flet-website-v2.pages.dev
Branch Preview URL: https://fix-windows-skip-taskbar-630.flet-website-v2.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The platform-specific state synchronization correctly addresses the reported Windows behavior without affecting macOS or Linux.

0 open findings

What changed in this PR

Fixes Windows taskbar hiding by tracking the last successfully applied state instead of relying on window_manager’s incorrect initial flag.

Changes:

  • Track Windows taskbar visibility as nullable state.
  • Apply the first requested value after startup or hot restart.
  • Document Windows 11 Alt+Tab behavior and add a changelog entry.
File Description
packages/​flet/​lib/​src/​utils/​desktop.dart Tracks and reports the applied Windows taskbar state.
packages/​flet/​lib/​src/​models/​window_state.dart Makes skipTaskBar nullable.
sdk/​python/​packages/​flet/​src/​flet/​controls/​core/​window.py Documents Windows 11 behavior.
CHANGELOG.md Records the user-facing fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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