Repository navigation
Linux autostart: an unpacked AppImage starts its AppRun - #348
Conversation
A package that unpacks the AppImage and starts its AppRun (the AUR thinkwatch-lite-bin, --appimage-extract) keeps the bundle marker the bundler patched into the binary, but no AppImage runtime ever set $APPIMAGE for it. `program` trusted the marker, asked for $APPIMAGE, found nothing and refused to write the entry — "The location of the AppImage file could not be determined (APPIMAGE is not set)" — so the launch-at-login toggle never turned on. Ask for $APPIMAGE only when it is actually there; otherwise point the entry at current_exe, the same line `update::linux_kind` draws for the updater. The pure part now takes the bundle type and $APPIMAGE as arguments, like `update::linux_kind`, so the new test runs everywhere.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
All contributors have signed the CLA ✍️ ✅ |
|
recheck |
|
I have read the CLA Document and I hereby sign the CLA |
An unpacked AppImage keeps the bundle marker but has no $APPIMAGE, and the previous commit pointed the entry at the running binary for it. Started that way it skips AppRun, which changes into usr/ and puts the bundled libraries first. The bundled WebKit needs both: the bundler rewrites /usr to ././ in it, so it looks for its helper processes relative to the working directory, and a session manager starts autostart entries from somewhere else. Point the entry at <AppDir>/AppRun instead, which is also what the AUR package's launcher starts, and at the binary only when there is no AppRun next to it. The mounted-AppImage check (the marker plus an absolute $APPIMAGE) now lives in one place, update::mounted_appimage, used by the updater, the menu entry and autostart. linux_kind used to accept any non-empty value. The new tests use Unix paths and a temporary AppDir, so they are #[cfg(unix)] like the module's other path tests: on Windows "/home/..." is not absolute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for tracking this down, and for the clear write-up. Using the bundle marker without
I pushed a follow-up commit (798a34a) to this branch:
Could you give it a quick try on Arch? With the app quit, start it the way the entry would, first the old way and then the new one: The second should open a working window from the tray. If it does, we'll merge this, and it will ship in the next release. |
|
Tested on Arch Linux with KDE/Wayland using the installed AUR package (
One qualification on the test setup: my agent session depends on the currently running ThinkWatch gateway, so I left that instance untouched. I tested each launcher in a separate D-Bus session with temporary XDG/data directories and an intentionally unreachable remote target, so no second local gateway was started. After the This verifies the launcher/runtime behavior with the installed package, not a build of 798a34a or an actual login/autostart-toggle end-to-end test. Using AppRun instead of the bare binary is confirmed by this comparison. Thanks for the follow-up fix! |
What happens
On an install whose AppImage was unpacked — the AUR
thinkwatch-lite-binpackage, or anyone who ran--appimage-extract— turning on Launch at login fails with:The toggle never turns on, and there is no way to get past it.
Why
The bundler patches a bundle marker into the binary, and
tauri::utils::platform::bundle_type()reads it. Unpacking the AppImage does not remove that marker, so an unpacked copy still reportsBundleType::AppImage— but$APPIMAGEis only set by the AppImage runtime when it mounts the image. StartingAppRundirectly (what the AUR package does) never sets it.autostart::linux::programbranched on the marker alone, so it asked for$APPIMAGE, found nothing, and returned the error above.update::linux_kindalready draws this distinction for the updater: marker and a non-empty$APPIMAGEmeans AppImage, anything else is a development build.desktop_entry::appimagedoes the same. Only the autostart path missed it.A
.deb/.rpmbuilt from the same tree would hit it too; Linux just does not ship those.The fix
Ask for
$APPIMAGEonly when it is really there, and otherwise point the entry atcurrent_exe()— the installed binary, which is what the user started. The bundle marker is left alone, sogateway::bundled_corestill findstwcoreandupdate::linux_kindstill refuses to self-update this copy.The pure part now takes the bundle type and
$APPIMAGEas arguments, exactly likeupdate::linux_kind, so the branch is testable on any platform.Verification
New unit test
the_bundle_marker_alone_is_not_an_appimagecovers: marker +$APPIMAGE→ the AppImage file; marker + no/empty/relative$APPIMAGE→ the running binary; no marker → the running binary; neither → an error.I could not run the full
cargo testhere (no WebKitGTK dev libraries on this machine), so the branch logic was checked withrustfmtplus a standalone replica ofprogram; CI will do the real compile.I have read the CLA Document and I hereby sign the CLA