#!/usr/bin/env bash set -euo pipefail LOGFILE="$HOME/.local/logs/desktop.log" export PATH="$HOME/.local/bin:$PATH" log() { echo "[$(date --iso-8601=seconds)] $*" | tee -a "$LOGFILE"; } DESKTOP_BIN="$(command -v startplasma-wayland || true)" if [ -z "$DESKTOP_BIN" ]; then log "ERROR: startplasma-wayland not found in PATH" exit 127 fi log "Launching Plasma: $DESKTOP_BIN" exec $DESKTOP_BIN >>"$LOGFILE" 2>&1 & sleep 5 systemd-run --user --slice=sunshine.slice --scope sunshine >>"$LOGFILE" 2>&1 || { log "ERROR: Failed to start Sunshine" exit 1 } & tail -f /dev/null