#!/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 SYMBOLIC=$DATA/icons/hicolor/symbolic/apps if [ "${1:-}" = "--uninstall" ]; then "$BIN/pause" quit 2>/dev/null || true rm -f "$BIN/pause" "$DESKTOP" "$AUTOSTART" "$ICON" \ "$SYMBOLIC/$APP_ID-symbolic.svg" "$SYMBOLIC/$APP_ID-off-symbolic.svg" 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")" "$SYMBOLIC" cat > "$BIN/pause" < "$DESKTOP" sed "s|@BIN@|$BIN|g" "$REPO/data/$APP_ID.autostart.desktop" > "$AUTOSTART" cp "$REPO/data/$APP_ID.svg" "$ICON" # Top-bar icons. Pause also points the tray at the checkout, but installing # them into the theme means any tray host can find them. cp "$REPO/data/icons/hicolor/symbolic/apps/"*.svg "$SYMBOLIC/" 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 &" if ! gnome-extensions info appindicatorsupport@rgcjonas.gmail.com >/dev/null 2>&1; then echo "For the top-bar icon, install the AppIndicator extension (see README):" echo " sudo dnf install gnome-shell-extension-appindicator" fi case ":$PATH:" in *":$BIN:"*) ;; *) echo "Note: $BIN is not in your PATH; use $BIN/pause" ;; esac