From e69e25c171c3c2b402909795f638a48d6f84f502 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 3 May 2024 11:03:55 +0200 Subject: [PATCH] linux: Use app_id as filepath for desktop file (#11337) This undoes the changes from #11333 and uses the path of the `.desktop` file instead. According ot the spec (https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) the filename and path of the `desktop` file are used to determine the desktop file ID. This is enough to match the windows (which have the same WMClass/app-id) with the desktop entry. Release Notes: - N/A --- crates/zed/resources/zed.desktop | 1 - script/install.sh | 33 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/crates/zed/resources/zed.desktop b/crates/zed/resources/zed.desktop index fe3aa1ace4a46fe45967a462b5693c6b10373613..7920e63fd7b3178643944b9b94bd201e9361a471 100644 --- a/crates/zed/resources/zed.desktop +++ b/crates/zed/resources/zed.desktop @@ -11,4 +11,3 @@ Icon=zed Categories=TextEditor;Development;IDE; Keywords=zed; MimeType=text/plain;inode/directory; -StartupWMClass=dev.zed.Zed diff --git a/script/install.sh b/script/install.sh index bd90c900591d94dbefd47dbf6abeb9c67dc466ed..84c8ce7a22e69119a2cf74309f825207975b3434 100755 --- a/script/install.sh +++ b/script/install.sh @@ -51,15 +51,42 @@ linux() { suffix="-$channel" fi + appid="" + case "$channel" in + stable) + appid="dev.zed.Zed" + ;; + nightly) + appid="dev.zed.Zed-Nightly" + ;; + preview) + appid="dev.zed.Zed-Preview" + ;; + dev) + appid="dev.zed.Zed-Dev" + ;; + *) + echo "Unknown release channel: ${channel}. Using stable app ID." + appid="dev.zed.Zed" + ;; + esac + + # Unpack rm -rf "$HOME/.local/zed$suffix.app" mkdir -p "$HOME/.local/zed$suffix.app" tar -xzf "$temp/zed-linux-$arch.tar.gz" -C "$HOME/.local/" + # Setup ~/.local directories mkdir -p "$HOME/.local/bin" "$HOME/.local/share/applications" + + # Link the binary ln -sf ~/.local/zed$suffix.app/bin/zed ~/.local/bin/ - cp ~/.local/zed$suffix.app/share/applications/zed$suffix.desktop ~/.local/share/applications/ - sed -i "s|Icon=zed|Icon=$HOME/.local/zed$suffix.app/share/icons/hicolor/512x512/apps/zed.png|g" ~/.local/share/applications/zed$suffix.desktop - sed -i "s|Exec=zed|Exec=$HOME/.local/zed$suffix.app/bin/zed|g" ~/.local/share/applications/zed$suffix.desktop + + # Copy .desktop file + desktop_file_path="$HOME/.local/share/applications/${appid}.desktop" + cp ~/.local/zed$suffix.app/share/applications/zed$suffix.desktop "${desktop_file_path}" + sed -i "s|Icon=zed|Icon=$HOME/.local/zed$suffix.app/share/icons/hicolor/512x512/apps/zed.png|g" "${desktop_file_path}" + sed -i "s|Exec=zed|Exec=$HOME/.local/zed$suffix.app/bin/zed|g" "${desktop_file_path}" if which zed >/dev/null 2>&1; then echo "Zed has been installed. Run with 'zed'"