fix(flet pack): Windows taskbar shortcut pointing to wrong .exe#6403
fix(flet pack): Windows taskbar shortcut pointing to wrong .exe#6403ndonkoHenri wants to merge 6 commits intorelease/v0.85.0from
flet pack): Windows taskbar shortcut pointing to wrong .exe#6403Conversation
flet pack): Windows taskbar shortcut pointing to wrong .exe
There was a problem hiding this comment.
Pull request overview
This PR improves flet pack-produced desktop apps by (1) ensuring the bundled Flutter client archive is actually discoverable at runtime (avoiding first-run downloads), and (2) fixing Windows taskbar pin/shortcut behavior by setting an AppUserModelID for the spawned flet.exe process (resolving #5151).
Changes:
- Expose and use a shared artifact naming function so
flet packcan bundle the exact archive nameensure_client_cached()expects. - Re-compress the patched client directory into a platform-appropriate archive during
flet pack(Windows.zip, Linux.tar.gz; macOS already repacks). - Add Windows AppUserModelID plumbing: Python sets
FLET_APP_USER_MODEL_ID, and the Windows runner reads it and callsSetCurrentProcessExplicitAppUserModelID().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/python/packages/flet-desktop/src/flet_desktop/init.py | Adds get_artifact_filename() and sets FLET_APP_USER_MODEL_ID in the child process env on Windows. |
| sdk/python/packages/flet-cli/src/flet_cli/commands/pack.py | Re-compresses the copied flet/ client directory into the runtime-expected archive format/name during packaging. |
| client/windows/runner/main.cpp | Reads FLET_APP_USER_MODEL_ID and sets the process AppUserModelID to fix taskbar association/pinning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Add changelog record. |
| flet_env["FLET_HIDE_WINDOW_ON_START"] = "true" | ||
|
|
||
| # On Windows, set AppUserModelID so the taskbar associates the Flet client window | ||
| # with the parent executable (e.g. a PyInstaller bundle) rather than the cached |
There was a problem hiding this comment.
What if the client being run without PyInstaller?
There was a problem hiding this comment.
Good point. I have now moved it out of flet_desktop, into the PyInstaller runtime hook instead.
Deploying flet-website-v2 with
|
| Latest commit: |
c87daa3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7e31d145.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-flet-pack.flet-website-v2.pages.dev |
Deploying flet-examples with
|
| Latest commit: |
c87daa3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://988b4d46.flet-examples.pages.dev |
| Branch Preview URL: | https://fix-flet-pack-4n4s.flet-examples.pages.dev |
Taskbar fix: When a packed Flet app runs on Windows, it spawns

flet.exe(the Flutter client) as a child process. Windows associates the taskbar entry with the child's executable path (~/.flet/client/.../flet.exe), so pinning the app creates a shortcut to the bare client. The fix sets a WindowsAppUserModelIDonflet.exevia theFLET_APP_USER_MODEL_IDenvironment variable, so Windows associates the taskbar entry with the parent application instead. Resolves Blank White Screen When Launching Flet App from Taskbar After Initial Launch #5151.Pack bundling fix:
flet packwas copying the extracted client files into the PyInstaller bundle, but at runtimeensure_client_cached()looks for an archive (flet-windows.zip/flet-linux-*.tar.gz). The archive was never found, so the app always fell back to downloading from GitHub on first launch — wasteful for released versions, broken for unreleased ones. macOS already re-packed correctly; Windows and Linux now do the same.Testable CI artifacts: https://github.com/flet-dev/flet/actions/runs/24401327648
Summary by Sourcery
Ensure packed Flet desktop apps bundle and launch the correct client archives across platforms and integrate with Windows taskbar pinning behavior.
Bug Fixes:
Enhancements: