fix(linux): avoid duplicate AppImage desktop launcher when managed by AM / AppMan (#6392) (#6394)

* fix(linux): avoid duplicate AppImage desktop launcher when managed by AM / AppMan (#6392)

* test(linux): cover AM / AppMan launcher detection in AppRun smoke test (#6392)
This commit is contained in:
Korg1ch
2026-10-16 16:37:17 -06:00
committed by GitHub
parent 19227022ca
commit 3c75db7a80
2 changed files with 33 additions and 0 deletions
+10
View File
@@ -53,6 +53,16 @@ integrate() {
break
fi
done
# AM / AppMan (#6392) install their own launcher, whose Exec runs a command on
# PATH rather than this AppImage, so the check above misses it. AM's author
# names the only two places it writes one: system-wide for AM, per user for
# AppMan and rootless installs.
for f in /usr/local/share/applications/photocraft-AM.desktop "$apps/photocraft-AM.desktop"; do
if [ -f "$f" ]; then
external=1
break
fi
done
if [ "$external" = 1 ]; then
if [ -f "$apps/$DESK_ID.desktop" ]; then
rm -f "$apps/$DESK_ID.desktop" 2>/dev/null || true
+23
View File
@@ -129,4 +129,27 @@ out="$(APPIMAGE="$odd" "$APPDIR/AppRun" x)" || fail "launch with an odd path exi
[ "$out" = "stub: x" ] || fail "odd path: $out"
[ ! -e "$XDG_DATA_HOME" ] || fail "integrated an AppImage path that needs escaping"
# 12. AM / AppMan (#6392): a photocraft-AM.desktop launcher in the user's applications
# dir owns the menu entry. AppRun removes its own entry left from an earlier run,
# writes no second one and still installs the icons.
rm -rf "$XDG_DATA_HOME"
"$APPDIR/AppRun" >/dev/null || fail "launch before AM install exited non-zero"
[ -f "$DESKTOP" ] || fail "no desktop entry before AM install"
am_desktop="$XDG_DATA_HOME/applications/photocraft-AM.desktop"
printf '[Desktop Entry]
Type=Application
Name=PhotoCraft
Exec=photocraft %%F
Icon=%s
' "$APP_ID" >"$am_desktop"
"$APPDIR/AppRun" >/dev/null || fail "launch with AM launcher exited non-zero"
[ ! -e "$DESKTOP" ] || fail "duplicate desktop entry kept alongside AM launcher (#6392)"
[ -f "$am_desktop" ] || fail "AM launcher was removed"
[ -f "$XDG_DATA_HOME/icons/hicolor/256x256/apps/$APP_ID.png" ] || fail "icons missing with AM launcher"
# 13. Once AM removes its launcher, AppRun writes its own entry again.
rm -f "$am_desktop"
"$APPDIR/AppRun" >/dev/null || fail "launch after AM removal exited non-zero"
[ -f "$DESKTOP" ] || fail "no desktop entry after the AM launcher was removed"
echo "AppRun desktop integration ok"