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