From 1d79a69cec967e62411c5b923594cbc8bfdfdebf Mon Sep 17 00:00:00 2001 From: Antigravity Agent Date: Sat, 3 Oct 2026 01:34:12 -0400 Subject: [PATCH] NetVM: netvm-chrome.sh auto-detects Wayland display --- bin/netvm-chrome.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/netvm-chrome.sh b/bin/netvm-chrome.sh index 5c51c64..4e1aa7c 100755 --- a/bin/netvm-chrome.sh +++ b/bin/netvm-chrome.sh @@ -22,6 +22,18 @@ while [ $# -gt 0 ]; do esac done [ -n "$PROFILE" ] || { usage; exit 1; } +# Visible launch needs a display. Auto-detect Wayland when the shell +# doesn't have one (e.g. ssh/bare terminal on a Wayland desktop). +if [ -z "${WAYLAND_DISPLAY:-}" ] && [ -z "${DISPLAY:-}" ]; then + for _s in "/run/user/$(id -u)"/wayland-*; do + case "$_s" in *.lock|*'\*') continue;; esac + [ -S "$_s" ] || continue + export WAYLAND_DISPLAY="$(basename "$_s")" + [ -z "${XDG_RUNTIME_DIR:-}" ] && export XDG_RUNTIME_DIR="/run/user/$(id -u)" + echo "display: auto-detected WAYLAND_DISPLAY=$WAYLAND_DISPLAY" >&2 + break + done +fi NODE="$PROFILE" netvm_names "$NODE" CHROME_BOX="${CHROME_BOX_BIN:-$HOME/Projects/chrome-box/chrome-box}"