build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Failing after 21s
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Failing after 20s
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 19s
build / module (push) Failing after 17s
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Failing after 19s
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / host-linux (push) Failing after 19s
build / host-windows-cross (push) Failing after 20s
build / obs (clang) (push) Failing after 20s
build / docs (push) Failing after 3s
build / obs (gcc) (push) Failing after 20s
build / host-windows-native (push) Canceled after 0s
build / idd (push) Canceled after 0s
Nested and virtual X servers accept xrandr --setmonitor but ignore it, so there is no way to describe a multi-monitor desktop to Xvfb or Xephyr. xcb:monitors lets a layout be given directly, which makes any X server usable as a multi-monitor capture source. demo-multimon.sh uses it to run the whole pipeline locally: a virtual desktop with real applications on three monitors, captured by the host, packed, and composed back by the real client, with the result captured to a PNG.
116 lines
3.8 KiB
Bash
Executable File
116 lines
3.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# A visible end to end demonstration of multi-monitor Looking Glass.
|
|
#
|
|
# Runs a virtual X server holding three "monitors" side by side, puts real
|
|
# applications on each, captures it with the host, and renders the composed
|
|
# result through the real client. The client's window is captured to a PNG.
|
|
#
|
|
# Everything runs locally, so this shows the whole pipeline without a VM.
|
|
#
|
|
# Usage: demo-multimon.sh <host-bin> <client-bin> [work-dir]
|
|
|
|
set -u
|
|
|
|
HOST="${1:?host binary required}"
|
|
CLIENT="${2:?client binary required}"
|
|
WORK="${3:-/tmp/lg-demo}"
|
|
|
|
GUEST=:97 # the "guest" desktop being captured
|
|
VIEW=:96 # where the client renders, so it can be captured
|
|
SHM=/dev/shm/lg-demo
|
|
|
|
MON_W=1280
|
|
MON_H=800
|
|
DESK_W=$((MON_W * 3))
|
|
|
|
cleanup() {
|
|
for p in ${PIDS:-}; do kill "$p" 2>/dev/null; done
|
|
pkill -f "Xvfb $GUEST" 2>/dev/null
|
|
pkill -f "Xvfb $VIEW" 2>/dev/null
|
|
rm -f "$SHM"
|
|
}
|
|
trap cleanup EXIT
|
|
PIDS=""
|
|
|
|
mkdir -p "$WORK"
|
|
|
|
echo "== guest desktop: ${DESK_W}x${MON_H}, three ${MON_W}x${MON_H} monitors =="
|
|
Xvfb $GUEST -screen 0 ${DESK_W}x${MON_H}x24 > "$WORK/xvfb-guest.log" 2>&1 &
|
|
PIDS="$PIDS $!"
|
|
sleep 2
|
|
|
|
# a distinct background per monitor region so the split is obvious
|
|
convert -size ${MON_W}x${MON_H} gradient:'#20304a'-'#0a0f18' \
|
|
-size ${MON_W}x${MON_H} gradient:'#1e4436'-'#08160f' \
|
|
-size ${MON_W}x${MON_H} gradient:'#4a2030'-'#18080f' \
|
|
+append "$WORK/bg.png" 2>/dev/null
|
|
DISPLAY=$GUEST display -window root "$WORK/bg.png" 2>/dev/null &
|
|
PIDS="$PIDS $!"
|
|
sleep 1
|
|
|
|
echo "== launching applications onto each monitor =="
|
|
# one clock per monitor, plus some moving content, positioned per region
|
|
DISPLAY=$GUEST xclock -digital -update 1 -bg '#101820' -fg '#7fd6ff' \
|
|
-geometry 300x80+80+60 > /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
DISPLAY=$GUEST xeyes -geometry 260x260+120+220 > /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
|
|
DISPLAY=$GUEST xclock -analog -update 1 -bg '#0d1f18' -fg '#7fffc4' \
|
|
-geometry 260x260+$((MON_W + 120))+150 > /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
DISPLAY=$GUEST xterm -geometry 44x12+$((MON_W + 80))+480 \
|
|
-bg '#08160f' -fg '#7fffc4' -e "while :; do date; sleep 1; done" \
|
|
> /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
|
|
DISPLAY=$GUEST xclock -digital -update 1 -bg '#200d16' -fg '#ff9fc4' \
|
|
-geometry 300x80+$((MON_W * 2 + 80))+60 > /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
DISPLAY=$GUEST xeyes -geometry 260x260+$((MON_W * 2 + 120))+220 \
|
|
> /dev/null 2>&1 & PIDS="$PIDS $!"
|
|
sleep 3
|
|
|
|
echo "== starting the host =="
|
|
rm -f "$SHM"
|
|
truncate -s 256M "$SHM"
|
|
DISPLAY=$GUEST "$HOST" app:capture=XCB app:shmFile="$SHM" \
|
|
"xcb:monitors=${MON_W}x${MON_H}+0+0,${MON_W}x${MON_H}+${MON_W}+0,${MON_W}x${MON_H}+$((MON_W * 2))+0" \
|
|
> "$WORK/host.log" 2>&1 &
|
|
PIDS="$PIDS $!"
|
|
sleep 3
|
|
|
|
grep -E "Multi-monitor|-> atlas" "$WORK/host.log" || {
|
|
echo "FAIL: host did not report a multi-monitor layout"
|
|
tail -20 "$WORK/host.log"; exit 1; }
|
|
|
|
echo
|
|
echo "== starting the client =="
|
|
Xvfb $VIEW -screen 0 $((DESK_W / 2 + 40))x$((MON_H / 2 + 40))x24 \
|
|
> "$WORK/xvfb-view.log" 2>&1 &
|
|
PIDS="$PIDS $!"
|
|
sleep 2
|
|
|
|
env -u WAYLAND_DISPLAY DISPLAY=$VIEW "$CLIENT" \
|
|
-f "$SHM" -s \
|
|
win:size=$((DESK_W / 2))x$((MON_H / 2)) win:autoResize=no \
|
|
win:borderless=yes win:position=0x0 app:display=all \
|
|
> "$WORK/client.log" 2>&1 &
|
|
PIDS="$PIDS $!"
|
|
sleep 8
|
|
|
|
grep -E "Composing|Showing" "$WORK/client.log" || {
|
|
echo "FAIL: client did not compose"
|
|
tail -20 "$WORK/client.log"; exit 1; }
|
|
|
|
echo
|
|
echo "== capturing what the client is showing =="
|
|
DISPLAY=$VIEW import -window root "$WORK/client-view.png" 2>/dev/null
|
|
convert "$WORK/client-view.png" -crop $((DESK_W / 2))x$((MON_H / 2))+0+0 \
|
|
+repage "$WORK/composed.png"
|
|
|
|
# the raw guest desktop, for comparison
|
|
DISPLAY=$GUEST import -window root -resize $((DESK_W / 2))x \
|
|
"$WORK/guest.png" 2>/dev/null
|
|
|
|
echo
|
|
echo " guest desktop : $WORK/guest.png"
|
|
echo " client output : $WORK/composed.png"
|
|
echo
|
|
echo "DEMO COMPLETE"
|