Nacre/spikes/webkit-egui/run/nested.sh
astar76 63b39d7b7e webkit-spike: hidden run result, D-035..D-040, plans 08 WebKit engine S044-S055
GTK 4 host + transparent egui GLArea over WebKitGTK proven hidden (Xvfb + nested
niri): pick fall-through, real input and IME, egui menus over video, pacing equal
with and without the overlay. Spike fixes: IM client widget, wl-input Y flip,
SPIKE_EGUI=0 layout, URL trim.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 02:01:11 -06:00

24 lines
1.5 KiB
Shell
Executable file

#!/bin/bash
# Hidden test harness used for the D-033 spike run (docs/engine/webkit-spike.md). Outputs and the throwaway home go to $SPIKE_RUN (default /tmp/webkit-spike).
# Hidden nested session: Xvfb :77 -> niri (winit backend on X11) -> Wayland socket in a throwaway runtime dir.
# usage: nested.sh start | stop ; env for clients: source $S/env
S=${SPIKE_RUN:-/tmp/webkit-spike}; HERE=$(cd "$(dirname "$0")" && pwd)
R=$S; mkdir -p $R
case $1 in
start)
RT=/run/user/$(id -u)/nsp; rm -rf $RT $R/home; mkdir -p $RT $R/home/.config $R/home/.cache $R/home/.local/share; chmod 700 $RT
Xvfb :77 -screen 0 1600x900x24 -nolisten tcp >$R/xvfb.log 2>&1 & echo $! >$R/xvfb.pid
sleep 1
env -i PATH=$PATH HOME=$R/home XDG_RUNTIME_DIR=$RT XDG_CONFIG_HOME=$R/home/.config XDG_CACHE_HOME=$R/home/.cache \
XDG_DATA_HOME=$R/home/.local/share DISPLAY=:77 LIBGL_ALWAYS_SOFTWARE=1 RUST_LOG=warn RUST_BACKTRACE=1 \
niri -c $HERE/niri.kdl >$R/niri.log 2>&1 & echo $! >$R/niri.pid
for i in $(seq 50); do ls $RT/wayland-* >/dev/null 2>&1 && break; sleep 0.2; done
W=$(ls $RT | grep -m1 '^wayland-[0-9]*$')
cat >$R/env <<E2
export HOME=$R/home XDG_RUNTIME_DIR=$RT XDG_CONFIG_HOME=$R/home/.config XDG_CACHE_HOME=$R/home/.cache XDG_DATA_HOME=$R/home/.local/share WAYLAND_DISPLAY=$W GDK_BACKEND=wayland
unset DISPLAY DBUS_SESSION_BUS_ADDRESS SWAYSOCK
export NIRI_SOCKET=\$(ls -d \$XDG_RUNTIME_DIR/niri*.sock)
E2
echo "wayland=$W"; cat $R/niri.log | tail -5;;
stop) kill $(cat $R/niri.pid) $(cat $R/xvfb.pid) 2>/dev/null;;
esac