Add headless streaming mode + Mac client + full docs

Headless mode (new) — for KVM-attached hosts streaming to disconnected clients
- --headless / --mirror flags; default headless on hostname JARVIS, mirror elsewhere
- New lib/headless.sh installs prep-cmd hooks to ~/.local/share/omarchy-moonlight/bin
- bin/sunshine-stream-do.sh creates/resizes a Hyprland HEADLESS-1 output to the
  connecting client's resolution and migrates the active workspace onto it
- bin/sunshine-stream-undo.sh tears down the headless output on disconnect and
  returns the workspace to a non-headless monitor when one is available
- lib/config.sh writes capture=wlr, output_name=HEADLESS-1, and the JSON
  global_prep_cmd entry referencing the installed hook paths
- lib/preflight.sh adds a preflight_headless step that checks hyprctl, jq, and
  a running Hyprland session (warn-only, install can proceed)
- lib/verify.sh adds checks for the hook scripts and the wlr/global_prep_cmd
  config lines

Mac client
- client/install-macos.sh: Darwin guard, Homebrew presence check, brew cask
  install of Moonlight, idempotent
- client/README.md: per-platform install (macOS / Android / iOS / Apple TV /
  Linux + Steam Deck) and the five-step first-pair walkthrough

Other
- jq added to the helper install set in lib/packages.sh (hooks parse Hyprland
  JSON output)
- README.md rewritten to cover both modes, the new flags, the tuned defaults
  per mode + per vendor, the headless internals, and the client pointer
This commit is contained in:
2026-05-18 10:31:08 -06:00
parent d6b0919149
commit 171ade4ff1
11 changed files with 590 additions and 72 deletions

View File

@@ -7,6 +7,7 @@ SUNSHINE_CONF="$SUNSHINE_CONF_DIR/sunshine.conf"
MANAGED_MARKER="# managed-by: omarchy-moonlight"
write_sunshine_config() {
local mode="${1:-mirror}"
mkdir -p "$SUNSHINE_CONF_DIR"
if [[ -f "$SUNSHINE_CONF" ]] && ! grep -qF "$MANAGED_MARKER" "$SUNSHINE_CONF"; then
@@ -31,19 +32,36 @@ write_sunshine_config() {
;;
esac
info "Writing tuned $SUNSHINE_CONF (GPU: $GPU_VENDOR)"
local capture_block
case "$mode" in
headless)
# wlr capture of the Hyprland headless output that prep-cmd hooks create.
# global_prep_cmd is parsed as a JSON array by Sunshine, so keep it on one line.
capture_block="# Capture: wlr — captures a Hyprland headless output created on stream start.
capture = wlr
output_name = HEADLESS-1
# Hooks that create/resize HEADLESS-1 on stream start and remove it on stop.
global_prep_cmd = [{\"do\":\"${DO_SCRIPT}\",\"undo\":\"${UNDO_SCRIPT}\"}]"
;;
mirror|*)
capture_block="# Capture: KMS (DRM) — the right choice on Wayland.
capture = kms"
;;
esac
info "Writing tuned $SUNSHINE_CONF (GPU: $GPU_VENDOR, mode: $mode)"
cat >"$SUNSHINE_CONF" <<EOF
$MANAGED_MARKER
# Generated by omarchy-moonlight install.sh on $(date -Iseconds)
# Delete this marker line to take ownership; the installer will then leave the file alone.
#
# Tuned for low-latency LAN streaming on Hyprland/Wayland with KMS capture.
# Tuned for low-latency LAN streaming on Hyprland/Wayland.
# Tune further via the web UI at https://localhost:47990
sunshine_name = ${HOSTNAME_SHORT}
# Capture: KMS (DRM) — the right choice on Wayland.
capture = kms
$capture_block
# Encoder tuned for $GPU_VENDOR
$encoder_block