Skip to content

fix(flet pack): Windows taskbar shortcut pointing to wrong .exe - #6403

Merged
FeodorFitsner merged 10 commits into
release/v0.85.0from
fix-flet-pack
Apr 21, 2026
Merged

fix(flet pack): Windows taskbar shortcut pointing to wrong .exe#6403
FeodorFitsner merged 10 commits into
release/v0.85.0from
fix-flet-pack

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Apr 10, 2026

Copy link
Copy Markdown
Contributor
  • 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 Windows AppUserModelID on flet.exe via the FLET_APP_USER_MODEL_ID environment 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.
    Screenshot 2026-04-10 at 2 13 23 PM

  • Pack bundling fix: flet pack was copying the extracted client files into the PyInstaller bundle, but at runtime ensure_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:

  • Fix Windows taskbar pinning so packed Flet apps are associated with the parent executable instead of the cached flet.exe client.
  • Ensure flet pack bundles the desktop client as an archive (zip/tar.gz) that matches ensure_client_cached() expectations on Windows and Linux, avoiding fallback network downloads.

Enhancements:

  • Expose a public get_artifact_filename() helper for determining the platform-specific desktop client archive name.
  • Improve pack command behavior by compressing patched client binaries into platform-appropriate archives before PyInstaller runs.
  • Clarify desktop client and environment-variable documentation strings in flet_desktop.

@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.

We've reviewed this pull request using the Sourcery rules engine

@ndonkoHenri ndonkoHenri changed the title Fix flet pack fix(flet pack): Windows taskbar shortcut pointing to wrong .exe Apr 10, 2026
@ndonkoHenri ndonkoHenri linked an issue Apr 10, 2026 that may be closed by this pull request
1 task

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.

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 pack can bundle the exact archive name ensure_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 calls SetCurrentProcessExplicitAppUserModelID().

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.

Comment thread sdk/python/packages/flet-cli/src/flet_cli/commands/pack.py Outdated
@FeodorFitsner

Copy link
Copy Markdown
Contributor

Add changelog record.

Comment thread sdk/python/packages/flet-desktop/src/flet_desktop/__init__.py Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 14, 2026

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 802da30
Status:⚡️  Build in progress...

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 14, 2026

Copy link
Copy Markdown

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 00cde42
Status: ✅  Deploy successful!
Preview URL: https://434c6a50.flet-examples.pages.dev
Branch Preview URL: https://fix-flet-pack-4n4s.flet-examples.pages.dev

View logs

Windows AUMIDs must be <=128 chars and contain no spaces, so passing
os.path.abspath(sys.executable) verbatim would silently fail with
E_INVALIDARG on paths like "C:\Program Files\...". Derive a stable
identifier from the sanitized exe name plus a SHA1 of the absolute
path for per-install uniqueness.
@FeodorFitsner
FeodorFitsner merged commit ad44bdb into release/v0.85.0 Apr 21, 2026
44 of 59 checks passed
@FeodorFitsner
FeodorFitsner deleted the fix-flet-pack branch April 21, 2026 18:46
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.

Blank White Screen When Launching Flet App from Taskbar After Initial Launch

4 participants