#!/usr/bin/env bash # # install_desktop.sh — put "Lektor AI" in the application menu and the dock. # # Two things live outside this folder afterwards, both under ~/.local and both # removable with --uninstall: # # ~/.local/share/applications/lektor-ai.desktop # ~/.local/share/icons/hicolor//apps/lektor-ai.png # # The desktop entry matches the running window through StartupWMClass, which is # the WM_CLASS that ui.py sets. Without the match the dock falls back to the raw # WM_CLASS for its hover label. # set -euo pipefail HERE="$(dirname "$(readlink -f "$0")")" APPS="$HOME/.local/share/applications" ICONS="$HOME/.local/share/icons/hicolor" ENTRY="$APPS/lektor-ai.desktop" SIZES=(16 32 48 64 128 256) if [[ "${1:-}" == "--uninstall" ]]; then rm -f "$ENTRY" for s in "${SIZES[@]}"; do rm -f "$ICONS/${s}x${s}/apps/lektor-ai.png" done echo "Removed the desktop entry and its icons." else for s in "${SIZES[@]}"; do src="$HERE/assets/icon-$s.png" [[ -f "$src" ]] || continue mkdir -p "$ICONS/${s}x${s}/apps" cp "$src" "$ICONS/${s}x${s}/apps/lektor-ai.png" done mkdir -p "$APPS" cat > "$ENTRY" </dev/null || true gtk-update-icon-cache -f -t "$ICONS" 2>/dev/null || true