#!/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