From 18ec44d77306efbb247fbafd185407b5963e8783 Mon Sep 17 00:00:00 2001 From: Lasse Lian Date: Fri, 16 Oct 2026 09:26:09 +0200 Subject: [PATCH] AppImage: leave the menu entry to launchers that set DESKTOPINTEGRATION (#1635) Thanks @lasselian. --- docs/book/src/guide/getting-started.md | 3 ++- packaging/linux/AppRun | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/book/src/guide/getting-started.md b/docs/book/src/guide/getting-started.md index 30940c6e..e98a158c 100644 --- a/docs/book/src/guide/getting-started.md +++ b/docs/book/src/guide/getting-started.md @@ -32,7 +32,8 @@ When updating from a build released under the previous product name, follow the The first time you open the AppImage it adds a menu entry and icons under `~/.local/share` (`applications/ai.storyteller.solidcraft.desktop`, `icons/hicolor`), so the desktop shows the right name and icon. It adds nothing if [appimaged](https://github.com/probonopd/go-appimage) -already made an entry for the file (and removes the entry SolidCraft added before). To +already made an entry for the file, or if a launcher such as Gear Lever or AppImageLauncher +started it (and removes the entry SolidCraft added before). To turn it off for good, create an empty file `~/.local/share/solidcraft/no-desktop-integration`, or start the AppImage with `SOLIDCRAFT_NO_DESKTOP_INTEGRATION=1`. diff --git a/packaging/linux/AppRun b/packaging/linux/AppRun index 6f718517..acd8f67f 100755 --- a/packaging/linux/AppRun +++ b/packaging/linux/AppRun @@ -11,7 +11,9 @@ # the launch untouched. Opt out with SOLIDCRAFT_NO_DESKTOP_INTEGRATION=1 (the pre-rename # SOLVECRAFT_NO_DESKTOP_INTEGRATION still works: compatibility shim, docs/compatibility.md), # or for good with an empty file $XDG_DATA_HOME/solidcraft/no-desktop-integration. Nothing is -# installed either when appimaged (go-appimage) already made an entry for this AppImage. +# installed either when appimaged (go-appimage) already made an entry for this AppImage, or when +# a launcher that manages AppImages (Gear Lever, AppImageLauncher) started it: it sets +# DESKTOPINTEGRATION and owns the menu entry. set -u @@ -42,10 +44,21 @@ integrate() { src_desktop="$APPDIR/usr/share/applications/$DESK_ID.desktop" [ -f "$src_desktop" ] || return 0 + apps="$data/applications" + # Gear Lever and AppImageLauncher write their own entry and start the AppImage with + # DESKTOPINTEGRATION set; treat that like appimaged: no entry from here, and drop the one + # this script wrote earlier (it would otherwise come back after the launcher's is removed). + if [ -n "${DESKTOPINTEGRATION:-}" ]; then + mine="$apps/$DESK_ID.desktop" + if [ -f "$mine" ] && grep -q '^Exec="' "$mine"; then + rm -f "$mine" + command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$apps" >/dev/null 2>&1 + fi + return 0 + fi # appimaged integrates AppImages itself (appimagekit_-.desktop, Exec= this file): # a second entry from here would show the app twice, so drop an entry this script wrote earlier # (only one it wrote: it points Exec at a path in quotes) and leave the rest to appimaged. - apps="$data/applications" for other in "$apps"/appimagekit_*.desktop; do if ! { [ -f "$other" ] && grep -qF "$appimage" "$other" 2>/dev/null; }; then continue