From 120afef8f7e3dbf104d4c2b26f42c4800d6578ed Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 3 Sep 2025 21:20:44 +0300 Subject: [PATCH] Add postinst script to place desktop icon on install Introduces a debian/postinst script in the build workflow to copy the ytsage.desktop file to the user's desktop during DEB package installation, ensuring the desktop icon is available. Also updates the icon cache and handles cases where the desktop directory or SUDO_USER is not set. --- .github/workflows/build-linux.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 3408398..251cb3c 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -125,6 +125,7 @@ jobs: ("assets", "assets"), ("ytsage.desktop", "share/applications/ytsage.desktop"), ("assets/branding/icons/icon.png", "share/pixmaps/ytsage.png"), + ("debian/postinst", "DEBIAN/postinst"), # Added for desktop icon ], ) @@ -174,6 +175,32 @@ jobs: StartupWMClass=YTSage DESKTOP + - name: Create postinst script for desktop icon + shell: bash + run: | + mkdir -p debian + cat > debian/postinst <<'POSTINST' + #!/bin/sh + set -e + # Copy .desktop file to user's desktop for icon + if [ -n "$SUDO_USER" ]; then + DESKTOP_DIR="/home/$SUDO_USER/Desktop" + if [ -d "$DESKTOP_DIR" ]; then + cp /usr/share/applications/ytsage.desktop "$DESKTOP_DIR/" + chmod +x "$DESKTOP_DIR/ytsage.desktop" + chown $SUDO_USER:$SUDO_USER "$DESKTOP_DIR/ytsage.desktop" + echo "Placed ytsage.desktop on $SUDO_USER's desktop" + else + echo "Warning: Desktop directory $DESKTOP_DIR not found, skipping desktop icon placement" + fi + else + echo "Warning: SUDO_USER not set, skipping desktop icon placement" + fi + # Update icon cache + gtk-update-icon-cache -f /usr/share/icons/hicolor/ 2>/dev/null || true + POSTINST + chmod +x debian/postinst + - name: Build AppImage, RPM and DEB shell: bash run: | @@ -257,4 +284,4 @@ jobs: files: | artifacts/* env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file