fix(snap): ship a desktop entry so the app appears in the launcher - #670
Merged
Conversation
The published snap exports no desktop launcher, so Tabularis does not appear in the app grid or app menu after `snap install tabularis`. The app can only be started from a terminal. Cause: snapd exports launchers from `meta/gui/` inside the snap, and that directory is empty in the packed snap. The desktop file from the bundled `.deb` lands in `usr/share/applications/`, which snapd does not export. Files under `snap/gui/` are copied verbatim into `meta/gui/` at pack time, so adding the entry there is enough to make snapd export it. The entry is written by hand rather than reusing the `.deb` file, which carries an empty `Categories=`, a lowercase `Name=tabularis` and a bare `Icon=tabularis` theme name that does not resolve under confinement. It also declares `MimeType=x-scheme-handler/tabularis` without a `%u` field code, so the deep-link handler is passed no URL; `Exec=tabularis %u` fixes that. Refs TabularisDB#669 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Reviewed by glm-5.2 · Input: 28.4K · Output: 6.3K · Cached: 182.5K |
Collaborator
|
Thanks a lot for this, both the fix and the level of detail in the verification. I reviewed it locally: the desktop entry is correct on every field (scheme, icon path, app name match for the Exec rewrite) and the validator behaves exactly as you described, so I'm going to merge it as is. I opened #671 for the .deb side you pointed out, in particular the missing |
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.
Fixes the snap having no launcher entry, reported in #669.
Problem
After
snap install tabularisthe app does not appear in the app grid / app menu. It can only be launched from a terminal.snapd exports launchers from
meta/gui/inside the snap. In the published revision that directory is empty, so nothing is exported:The desktop file from the bundled
.debis present, but inusr/share/applications/, which snapd does not export.Change
Adds
snap/gui/tabularis.desktop. Files undersnap/gui/are copied verbatim intometa/gui/at pack time, which is exactly the directory snapd reads.The entry is written by hand rather than pointing
snapcraft.yamlat the.deb's copy via thedesktop:key, because that file is not good enough as shipped:Name=tabularisis lowercase (it followsproductNameintauri.conf.json).Categories=is empty, so the entry files under no menu category.Icon=tabularisis a bare theme name; under confinement the host icon theme has no such icon, so it resolves to nothing.MimeType=x-scheme-handler/tabularisbutExec=has no%ufield code, so the registered deep-link handler is invoked with no URL.The new entry fixes all four and keeps
Categories=to registered values (Developmentmain category,Databaseadditional).Verification
Verified on snapd 2.76.2 / core24 / Ubuntu 24.04 by installing a snap that contains this change and inspecting what snapd exported.
Method, stated precisely: I did not run
snapcraft pack(no snapcraft or LXD on this machine). Instead I took the published revision 43 straight from/snap/tabularis/current, dropped this one file intometa/gui/, repacked withsnap pack, and sideloaded it with--dangerous. The test snap is therefore byte-identical to the published snap plus exactly this file, which isolates the change. What this exercises is snapd's export behaviour; thesnap/gui/→meta/gui/copy at pack time is standard snapcraft behaviour and is not covered by this test.meta/gui/in the packed test snap now contains the entry, where the published revision has an empty directory:After
snap install --dangerous, snapd exported the launcher — the file that does not exist at all for the published revision:The two rewrites this change depends on both happened, and the only differences from the source file are the two
X-Snap*keys snapd injects:Icon=${SNAP}/...was expanded to/snap/tabularis/current/..., and the target resolves (PNG image data, 512 x 512, 8-bit/color RGBA).Exec=tabularis %ubecameExec=/snap/bin/tabularis %u— the bare app name resolves because it equals the snap name, and the%ufield code survived, so the deep-link handler now receives its URL.desktop-file-validatereports the exported file clean, no errors or warnings. The scheme handler registers:gio mime x-scheme-handler/tabularisliststabularis_tabularis.desktop.End to end, the entry also shows up where it is supposed to: with the test snap installed, Tabularis appears in the desktop environment with its icon and an "Open" button in App Center, and launching it from there starts the app.
One caveat on the literal in-repo file:
desktop-file-validateflagsIcon=${SNAP}/...as "looks like a relative path". That is a known false positive — the validator does not know about snapd's expansion, and the shipping DBeaver, Spotify and Discord snaps all use the sameIcon=${SNAP}/...pattern and produce the identical error. Once expanded, as shown above, it validates clean.Notes
desktop: usr/share/applications/tabularis.desktoptosnapcraft.yaml. Both routes writemeta/gui/tabularis.desktop; thesnap/gui/file alone is the whole change.ci.ymlis path-filtered tosrc/**,src-tauri/**and friends, andsnap.ymlruns only onrelease: publishedor manual dispatch. Hence the manual evidence above. Happy to re-run any of it, or to verify through a realsnapcraft packif a maintainer wants that closed too.bundle.categoryis unset insrc-tauri/tauri.conf.json(the actual reasonCategories=is empty in the.deb), andproductNameis lowercase. Both also affect the.deb, AppImage and macOS builds.