event-tracker/install-launcher.sh

19 lines
799 B
Shell
Raw Normal View History

#!/usr/bin/env bash
# Generates event-tracker.desktop for wherever this repo is actually
# cloned (event-tracker.desktop.in is a template, not a working launcher
# — it has no machine-specific path baked in) and installs it. Re-run
# any time after moving the clone; safe to re-run otherwise.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEST="$HOME/.local/share/applications/event-tracker.desktop"
mkdir -p "$(dirname "$DEST")"
sed \
-e "s#__EXEC_PATH__#$SCRIPT_DIR/event_tracker.py#" \
-e "s#__ICON_PATH__#$SCRIPT_DIR/event-tracker.png#" \
"$SCRIPT_DIR/event-tracker.desktop.in" > "$DEST"
chmod +x "$SCRIPT_DIR/event_tracker.py" "$DEST"
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
echo "Installed launcher: $DEST"