Repository navigation
feat(flet build linux): show the app's icon and name in the dock with a desktop entry while it runs - #7001
Open
ndonkoHenri wants to merge 2 commits into
Open
feat(flet build linux): show the app's icon and name in the dock with a desktop entry while it runs#7001ndonkoHenri wants to merge 2 commits into
flet build linux): show the app's icon and name in the dock with a desktop entry while it runs#7001ndonkoHenri wants to merge 2 commits into
Conversation
Deploying flet-website-v2 with
|
| Latest commit: |
019356c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://884b1f2f.flet-website-v2.pages.dev |
| Branch Preview URL: | https://feat-linux-desktop-entry.flet-website-v2.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#6799 gave
flet build linuxapps a window icon and shipped a desktop entry in the bundle, undershare/. But most desktops never read that window icon:.desktopentries._NET_WM_ICON.Until the user copies
share/into~/.local/shareby hand, the dock shows a generic icon, and its tooltip shows the bundle id (com.example.my_app) instead of the product name.This PR makes the app install that entry for the current user while it runs.
What the app does
$XDG_DATA_HOME/applications/<bundle_id>.desktop(~/.local/shareby default), built from the entry in the bundle.Exec=gets the executable's absolute path ($APPIMAGEfor an AppImage), andIcon=gets a copy of the icon in$XDG_RUNTIME_DIR/flet/<bundle_id>/. The dock picks it up live, with no relaunch.NoDisplay=true, so the app doesn't appear in the app grid or launcher search. Launchers still list its open window.atexit, and on SIGTERM, SIGINT and SIGHUP. Per-instance markers in the runtime dir track whether another instance is still running. If the app is killed hard, or callssys.exit()(which skips cleanup), the next start rewrites the entry.<bundle_id>.desktop. I tested a separately named entry withStartupWMClass, and GNOME on Wayland didn't match it.What the app leaves alone
X-Flet-Generatedkey). Also an unreadable entry or a symlink, which is checked withlstat..debapp). If one exists, the app removes its own user entry, which would otherwise hide the system one. The bundle's ownshare/is excluded from that scan byst_dev/st_ino.FLATPAK_ID/SNAP).%. GLib checks thatExec=exists using the raw path, so the escaped%%makes it reject the entry.Apps can turn this off:
Trade-off: an entry that only exists while the app runs means pinning a portable app to the dock lasts only while it runs. Users who want a permanent pin or an app-grid entry can still install the entry and icon from
share/. The docs cover this, as does the AppImage note.Screenshots
All shots are from the same arm64 test app (
flet build linux, product "Icon Probe"). Before is the same app built withdesktop_entry = false, which installs no entry: that's whatflet-1.1.0apps get today. Its product name is therefore "Icon Probe Optout".Ubuntu 24.04, GNOME 46, Wayland. The icon and the tooltip name are both fixed:
Fedora 44, GNOME 50, Wayland (overview dash):
Fedora 44, KDE Plasma, Wayland:
Pop!_OS 24.04, COSMIC, Wayland:
Kali, Xfce, X11. This one already worked from the window icon, and nothing changes:
Testing
All on VMs (arm64), with a bundle built on Ubuntu 24.04:
%path gets no entry, and the app still runs;share/is inXDG_DATA_DIRS;Exec=is the AppImage file, and the entry stays until the last one exits;desktop_entry = falsewrites no entry.The
flet run/flet packdesktop client (client/linux) is unchanged.Summary by Sourcery
Make Linux builds register their app identity with desktop environments while running so docks show the correct name and icon without adding the app to launchers.
New Features:
flet build linuxapps run so desktop docks can display the product name and icon across supported Wayland and GNOME environments.[tool.flet.linux] desktop_entry = false.Bug Fixes:
Documentation: