fix(launcher): installed web apps launch through TronBrowser, not the raw engine - #87
Merged
Merged
Conversation
… raw engine Installing a web app writes a freedesktop shortcut, and the engine writes it against ITSELF -- `Exec=` is the Chromium binary plus `--app-id=`. That is the one launch path in TronBrowser that never comes through launcher/tronbrowser, so an app started from its desktop icon gets none of what the launcher sets up: no bundled extensions, no --class, and no GPU mode. Under the Flathub engine the recorded path is the in-sandbox /app/... one, which does not exist on the host at all, so the icon cannot launch anything. That is why "install app" from the address bar works and the same app dies from its icon: the address bar hands the request to a browser the launcher already configured, while the icon starts a fresh one it never touched. launcher/tron-pwa repoints those shortcuts at the launcher, keeping every Chromium switch they carried -- the app id, the profile, the user data dir and the shortcuts-menu switches -- so each icon still opens the app it named, in the profile it was installed in. It hands back the shortcut's own StartupWMClass as --class, because the launcher stamps --class=TronBrowser on everything it starts and a window whose class does not match never binds to its taskbar entry. The shim runs it on every start rather than once at install: the engine rewrites these files whenever an app's manifest or icon changes, which puts the engine path straight back. `tron pwa` is the manual handle and `tron pwa list` the diagnostic; `tron remove` reverts, so uninstalling does not strand every icon on a launcher that is about to be deleted. Only shortcuts whose --user-data-dir is a TronBrowser profile are touched. A real Chrome's web apps are left byte-identical. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZXtxiVkXd7rFmvrMYV7Ut
ThreatCrush Security Scan49 finding(s) MEDIUM: 31 | LOW: 18
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
The bug
Installed web apps crash when launched from their desktop icon, but open fine
when installed from the address bar.
Why
Installing a web app writes a freedesktop shortcut, and the engine writes it
against itself —
Exec=is the Chromium binary plus--app-id=:That is the one launch path in TronBrowser that never comes through
launcher/tronbrowser. Clicking the icon starts a fresh browser with none ofwhat the launcher sets up — no
--load-extension, no--class, and no GPU modefrom
tron gpu safe|off. Two ways it presents:in-sandbox
/app/...one, which does not exist on the host. Nothing canlaunch it.
machine kept usable by
tron gpu safegets, in its PWA windows only, exactlythe GPU process those settings exist to avoid.
Installing from the address bar works because the app window is created by the
already-running browser, which the launcher had configured.
The fix
launcher/tron-pwarepoints those shortcuts at the launcher, keeping everyChromium switch they carried — app id, profile directory, user data dir, and the
[Desktop Action]shortcuts-menu switches — so each icon still opens the app itnamed in the profile it was installed in.
It hands the shortcut's own
StartupWMClassback as--class: the launcherstamps
--class=TronBrowseron everything it starts, and a window whose classdoes not match its
StartupWMClassnever binds to its taskbar entry.The shim runs
syncon every start, not once at install — the enginerewrites these files whenever an app's manifest or icon changes, putting the
engine path straight back.
Scope
Only shortcuts whose
--user-data-diris a TronBrowser profile are touched; areal Chrome's web apps come out byte-identical (pinned by a test).
tron removereverts, so uninstalling does not strand every icon on a launcher that is about
to be deleted.
Tests
14 new cases in
apps/desktop/test/pwa.test.ts, including one that runs the realshim against a stub browser and asserts a broken shortcut is repaired on start.
Full desktop suite: 103 passing. Typecheck and lint clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SZXtxiVkXd7rFmvrMYV7Ut