Files
os/tools/vm/vmshot.sh
2026-10-24 09:06:06 +02:00

11 lines
530 B
Bash

#!/usr/bin/env bash
# Screenshot of the VM's Wayland session (needs grim in the VM).
# vmshot.sh /local/out.png
D="$(dirname "$0")"
OUT="${1:-/root/vm-shot.png}"
if ! "$D/vmssh.sh" 'command -v grim >/dev/null || test -x /usr/local/bin/grim'; then
"$D/vmcp.sh" /usr/bin/grim vm:/usr/local/bin/grim
fi
"$D/vmssh.sh" 'G=$(command -v grim || echo /usr/local/bin/grim); runuser -u tv -- env XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-0 "$G" /tmp/shot.png' &&
"$D/vmcp.sh" vm:/tmp/shot.png "$OUT" && echo "saved $OUT"