From 6f3426c481f03f5beeed9171b3280f0070798844 Mon Sep 17 00:00:00 2001 From: Christopher Warner Date: Tue, 13 Oct 2026 15:07:53 -0400 Subject: feat: package portable Aerial screensaver for sharing Add install/uninstall scripts, XDG config, portable VAAPI detection, fetch-aerial-recent helper, and a LocalSend-ready zip without Apple video assets. Co-authored-by: Cursor --- install.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 install.sh (limited to 'install.sh') diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..63a1554 --- /dev/null +++ b/install.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Install Aerial screensaver user service + helpers. +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BIN_DIR="${XDG_BIN_HOME:-$HOME/.local/bin}" +UNIT_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user" +CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aerial-screensaver" +VIDEO_DIR="${VIDEO_DIR:-$HOME/Videos/Screensavers/Aerial}" + +need() { + if ! command -v "$1" >/dev/null 2>&1; then + echo "Missing dependency: $1" >&2 + MISSING=1 + fi +} + +MISSING=0 +need python3 +need mpv +need systemctl +# PyGObject (gi) is required +if ! python3 -c 'from gi.repository import Gio, GLib' 2>/dev/null; then + echo "Missing dependency: PyGObject (python3-gobject / python3-gi)" >&2 + MISSING=1 +fi +if [[ "$MISSING" -ne 0 ]]; then + echo "Install the packages above, then re-run ./install.sh" >&2 + exit 1 +fi + +detect_vaapi() { + local p + if [[ -n "${VAAPI_DEVICE:-}" && -e "$VAAPI_DEVICE" ]]; then + printf '%s\n' "$VAAPI_DEVICE" + return 0 + fi + if [[ -d /dev/dri/by-path ]]; then + for p in /dev/dri/by-path/*-render; do + [[ -e "$p" ]] || continue + [[ "$(basename "$p")" == *usb* ]] && continue + printf '%s\n' "$p" + return 0 + done + fi + for p in /dev/dri/renderD*; do + [[ -e "$p" ]] || continue + printf '%s\n' "$p" + return 0 + done + return 1 +} + +VAAPI="$(detect_vaapi || true)" + +mkdir -p "$BIN_DIR" "$UNIT_DIR" "$CFG_DIR" "$VIDEO_DIR" + +install -m 0755 "$ROOT/aerial_screensaver.py" "$BIN_DIR/aerial-screensaver" +install -m 0755 "$ROOT/bin/encode-aerial-lite" "$BIN_DIR/encode-aerial-lite" +install -m 0755 "$ROOT/bin/fetch-aerial-recent" "$BIN_DIR/fetch-aerial-recent" +install -m 0644 "$ROOT/aerial-screensaver.service" "$UNIT_DIR/aerial-screensaver.service" + +if [[ ! -f "$CFG_DIR/config" ]]; then + cat > "$CFG_DIR/config" <