Files
sysadmin-chronicles/runtime/viewer/detect-viewer-backends.sh
T
44r0n7 0265afa054 chore: bootstrap lean sysadmin-chronicles repo
Import the runnable game code, content, docs, scripts, and repo guidance while leaving local agent state, dependency installs, build output, and backup copies out of the published tree.
2026-05-02 11:49:07 -04:00

29 lines
776 B
Bash

#!/usr/bin/env bash
# detect-viewer-backends.sh — Detect which VM viewer backends are available.
#
# Outputs a line for each detected backend: "vnc" or "spice"
# Used by DisplayAdapter.detect() to choose the right viewer at runtime.
#
# Exit code 0 always (even if nothing is found — caller handles empty output).
set -euo pipefail
# VNC viewers
if command -v virt-viewer &>/dev/null; then
echo "spice"
echo "vnc"
elif command -v remote-viewer &>/dev/null; then
echo "spice"
echo "vnc"
elif command -v xvncviewer &>/dev/null || command -v xtightvncviewer &>/dev/null || \
command -v vinagre &>/dev/null || command -v vncviewer &>/dev/null; then
echo "vnc"
fi
# SPICE standalone
if command -v spicy &>/dev/null; then
echo "spice"
fi
exit 0