spikes/gpui: the GPUI spikes' workspace, environment and meter
Plan section 6 step 1. A Cargo workspace of its own under spikes/gpui (own lock, not a member of the root workspace, so the root's lock, deny policy, notices and CI are untouched; it builds into the checkout's target/), on gpui-kit pinned to =0.8.0. No gpui-kit release builds on Rust 1.94 (every gpui-pre 0.3.x calls std::hint::cold_path, stable since 1.95), so the workspace says rust-version 1.95. - shell.sh: the toolchain (1.95.0, 1.94, stable or nightly, all from one pinned fenix), the native libraries, Mesa's lavapipe as the only Vulkan driver, Xvfb, openbox and the X tools, Noto Color Emoji and Noto Sans CJK. - headless.sh: a private Xvfb display with openbox and a private session bus, never the desktop's; headless-wayland.sh: sway's headless backend. - spike-common: CPU by thread group and memory from /proc once a second with the spike's counters (meter), proc-meter and damage-count for programs without a meter (the Slint app), Inter and the emoji/CJK fonts, the client's Lucide icons as GPUI assets, and the BGRA twin of voelin_media::convert::to_rgba. From the interrupted 2026-10-25 attempt, kept; changed here: shell.sh takes 1.94 and nightly from the pinned fenix (the store paths it named were garbage-collected), the README's headless-wayland.sh paragraph (sway, not weston), its fmt command (-p, not --all), its toolchain and nixpkgs lines, and the font docs (GPUI drops Noto Color Emoji from a fallback chain). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3930ef2945
commit
c9859bcfb4
15 files changed
+10058
No files matched your search
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
# Run a command on a private headless X display: Xvfb, a window manager
|
||||
# (openbox: fullscreen, activation and close requests need one) and a
|
||||
# private D-Bus session bus, so nothing reaches the desktop the command is
|
||||
# started from (its Wayland or X display, its session bus, its portals).
|
||||
#
|
||||
# spikes/gpui/headless.sh [-d DISPLAY_NUMBER] [-s WIDTHxHEIGHT] [-n] -- COMMAND...
|
||||
#
|
||||
# -d: the display number (default 91); -s: the screen size (default
|
||||
# 3840x2160); -n: no window manager. Run it inside shell.sh (Xvfb, openbox
|
||||
# and dbus come from there). The display, the window manager's and the
|
||||
# command's state live in $SPIKE_STATE (default: .scratch/gpui-spikes-state
|
||||
# of the checkout, which git ignores).
|
||||
set -eu
|
||||
number=91 size=3840x2160 wm=1
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-d) number=$2; shift 2 ;;
|
||||
-s) size=$2; shift 2 ;;
|
||||
-n) wm=0; shift ;;
|
||||
--) shift; break ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
[ $# -gt 0 ] || { echo "headless.sh: no command" >&2; exit 2; }
|
||||
root=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
SPIKE_STATE=${SPIKE_STATE:-$root/.scratch/gpui-spikes-state}
|
||||
mkdir -p "$SPIKE_STATE/runtime" "$SPIKE_STATE/config" "$SPIKE_STATE/data" "$SPIKE_STATE/cache"
|
||||
chmod 700 "$SPIKE_STATE/runtime"
|
||||
if [ -e "/tmp/.X11-unix/X$number" ]; then
|
||||
echo "headless.sh: display :$number is taken" >&2
|
||||
exit 1
|
||||
fi
|
||||
Xvfb ":$number" -screen 0 "${size}x24" -nolisten tcp -noreset >"$SPIKE_STATE/xvfb-$number.log" 2>&1 &
|
||||
xvfb=$!
|
||||
trap 'kill $wm_pid $xvfb 2>/dev/null; wait $xvfb 2>/dev/null || true' EXIT INT TERM
|
||||
wm_pid=
|
||||
i=0
|
||||
until [ -e "/tmp/.X11-unix/X$number" ]; do
|
||||
i=$((i + 1))
|
||||
[ $i -lt 100 ] || { echo "headless.sh: Xvfb did not start" >&2; exit 1; }
|
||||
sleep 0.1
|
||||
done
|
||||
# Never the desktop's display, bus or portals.
|
||||
unset WAYLAND_DISPLAY WAYLAND_SOCKET XDG_SESSION_TYPE DBUS_SESSION_BUS_ADDRESS
|
||||
export DISPLAY=":$number"
|
||||
export XDG_RUNTIME_DIR="$SPIKE_STATE/runtime" XDG_CONFIG_HOME="$SPIKE_STATE/config"
|
||||
export XDG_DATA_HOME="$SPIKE_STATE/data" XDG_CACHE_HOME="$SPIKE_STATE/cache"
|
||||
export GPUI_X11_SCALE_FACTOR=${GPUI_X11_SCALE_FACTOR:-1}
|
||||
if [ $wm = 1 ]; then
|
||||
openbox --sm-disable >"$SPIKE_STATE/openbox-$number.log" 2>&1 &
|
||||
wm_pid=$!
|
||||
sleep 0.5
|
||||
fi
|
||||
# A session bus of its own that starts no services: the desktop's portals
|
||||
# (and their backends, which look for a compositor) stay out of the run.
|
||||
cat >"$SPIKE_STATE/dbus-session.conf" <<CONF
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<type>session</type>
|
||||
<listen>unix:path=$SPIKE_STATE/runtime/bus</listen>
|
||||
<auth>EXTERNAL</auth>
|
||||
<policy context="default">
|
||||
<allow send_destination="*" eavesdrop="true"/>
|
||||
<allow eavesdrop="true"/>
|
||||
<allow own="*"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
CONF
|
||||
dbus-run-session --config-file="$SPIKE_STATE/dbus-session.conf" -- "$@"
|
||||
Reference in new issue
Block a user