#!/bin/sh # Install Pause for the current user, running straight from this checkout # (so `git pull` updates it). Use --uninstall to remove it again. set -eu REPO=$(cd "$(dirname "$0")" && pwd) BIN=${XDG_BIN_HOME:-$HOME/.local/bin} DATA=${XDG_DATA_HOME:-$HOME/.local/share} CONFIG=${XDG_CONFIG_HOME:-$HOME/.config} APP_ID=net.reudy.Pause DESKTOP=$DATA/applications/$APP_ID.desktop AUTOSTART=$CONFIG/autostart/$APP_ID.desktop ICON=$DATA/icons/hicolor/scalable/apps/$APP_ID.svg if [ "${1:-}" = "--uninstall" ]; then "$BIN/pause" quit 2>/dev/null || true rm -f "$BIN/pause" "$DESKTOP" "$AUTOSTART" "$ICON" echo "Pause removed. Your notes are still in $DATA/pause/." exit 0 fi if ! python3 -c 'import gi; gi.require_version("Gtk", "4.0"); gi.require_version("Adw", "1")' 2>/dev/null; then echo "GTK 4 / libadwaita for Python are missing. On Fedora:" >&2 echo " sudo dnf install python3-gobject gtk4 libadwaita" >&2 exit 1 fi mkdir -p "$BIN" "$(dirname "$DESKTOP")" "$(dirname "$AUTOSTART")" "$(dirname "$ICON")" cat > "$BIN/pause" < "$DESKTOP" sed "s|@BIN@|$BIN|g" "$REPO/data/$APP_ID.autostart.desktop" > "$AUTOSTART" cp "$REPO/data/$APP_ID.svg" "$ICON" update-desktop-database "$DATA/applications" 2>/dev/null || true gtk-update-icon-cache -q "$DATA/icons/hicolor" 2>/dev/null || true echo "Installed. Pause starts automatically when you log in." echo "Start it now with: pause &" case ":$PATH:" in *":$BIN:"*) ;; *) echo "Note: $BIN is not in your PATH; use $BIN/pause" ;; esac