AppImage: no desktop entry when appimaged made one or integration is switched off (#1406)
AppRun installs nothing when an appimagekit_*.desktop entry for the same AppImage exists, and removes the entry it wrote earlier. An empty ~/.local/share/solidcraft/no-desktop-integration turns the integration off for good; SOLIDCRAFT_NO_DESKTOP_INTEGRATION=1 still works. Getting-started guide documents it. Fixes #1399.
This commit is contained in:
1 parent
d4ab9545a1
commit
fb55c1341a
2 files changed
+29
-2
No files matched your search
@@ -27,6 +27,15 @@ Open the release `.dmg` and drag `SolidCraft.app` onto Applications.
|
||||
When updating from a build released under the previous product name, follow the
|
||||
[macOS upgrade notes](https://github.com/bherbruck/solidcraft/blob/main/docs/compatibility.md#macos) so you replace it rather than install a second copy.
|
||||
|
||||
### Linux AppImage
|
||||
|
||||
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
|
||||
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`.
|
||||
|
||||
### Linux Flatpak
|
||||
|
||||
Install Flatpak using your distribution's package manager. For an installation that receives
|
||||
|
||||
+20
-2
@@ -9,7 +9,9 @@
|
||||
# (and whenever the AppImage's path changes) install the .desktop entry and the
|
||||
# hicolor icons into $XDG_DATA_HOME, then launch. Every failure here must leave
|
||||
# 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).
|
||||
# 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.
|
||||
|
||||
set -u
|
||||
|
||||
@@ -36,12 +38,28 @@ integrate() {
|
||||
home="${HOME:-}"
|
||||
[ -n "$home" ] || return 0
|
||||
data="${XDG_DATA_HOME:-$home/.local/share}"
|
||||
[ -e "$data/solidcraft/no-desktop-integration" ] && return 0
|
||||
src_desktop="$APPDIR/usr/share/applications/$DESK_ID.desktop"
|
||||
[ -f "$src_desktop" ] || return 0
|
||||
|
||||
# appimaged integrates AppImages itself (appimagekit_<hash>-<name>.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
|
||||
fi
|
||||
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
|
||||
done
|
||||
|
||||
# Rewrite Exec to this AppImage (the binary is not on the host PATH) and drop
|
||||
# TryExec, which would hide the entry; everything else is shipped as packaged.
|
||||
apps="$data/applications"
|
||||
mkdir -p "$apps" 2>/dev/null || return 0
|
||||
tmp="$apps/.$DESK_ID.tmp.$$"
|
||||
esc="$(printf '%s' "$appimage" | sed 's/[\\&|]/\\&/g')"
|
||||
|
||||
Reference in new issue
Block a user