Files
lumbridge-code/scripts/open-metal-lumbridge.sh
T
Metal AgentandClaude Opus 5 316fa32745 Graduate the shell out of spikes/ into apps/lumbridge
The product was spikes/gpui-shell: a cargo workspace of its own, named in the
root manifest's exclude list. It inherited neither unsafe_code = "forbid" nor
clippy pedantic, and ./scripts/ci.sh never compiled it. Every test written into
it silently never ran, and apps/lumbridge was an eleven-line stub printing a
version string.

Four separate research passes over the sidebar, settings, devices, and theme
work independently discovered they were about to write substantial new code into
that directory. Graduating first means writing it once.

- apps/lumbridge is the product; spikes/ui-shell-model becomes
  crates/lumbridge-ui-fixture and joins the workspace.
- scripts/ci.sh takes --headless and --ui. The headless pass excludes the two UI
  crates by name, so a contributor changing lumbridge-core does not wait on a
  window toolkit, and a runner that cannot carry GPUI still gates everything
  else. A new crate is headless by default rather than silently joining the slow
  job.
- scripts/native-libs.sh replaces the ad-hoc symlink in the launcher, and says
  which apt package actually fixes the problem instead of working around it
  silently. The stale libxcb/libxkbcommon symlinks in the old spike target
  directory are gone; only libxkbcommon-x11.so was ever needed.
- deny.toml and cargo deny check licenses. spikes/README.md called GPUI's
  licence closure a hard gate and the scorecard scored it pending; graduation
  makes it the product's closure, so it is enforced rather than described. Two
  rejections were reviewed and allowed with the reasoning recorded in the file:
  webpki-roots under CDLA-Permissive-2.0 (Mozilla's CA store, data not code,
  reached through ureq) and libfuzzer-sys under NCSA (reached only under
  all-features via gpui's image decoder; no shipped build links it).

Clippy pedantic across both crates is clean at -D warnings. render was 353
lines; render_sidebar, render_tabs, and render_root come out of it, which the
sidebar rework needed anyway. The remaining over-length functions are single
declarative element trees and carry per-function allows with reasons, not a
blanket suppression.

Decision 0017 records the two calls this forces: published gpui 0.2.2 behind an
accessibility adapter rather than an unpinned Zed revision and an MSRV bump, and
Floem frozen rather than maintained in parity or deleted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 23:05:12 -07:00

117 lines
4.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
repo_path=${LUMBRIDGE_REPO:-/home/metal/Desktop/Lumbridge Code/lumbridge}
window_title='Lumbridge · GPUI workspace'
bacon_title='Lumbridge · Bacon'
manifest_path="$repo_path/Cargo.toml"
binary_path="$repo_path/target/debug/lumbridge"
if [[ ! -d "$repo_path/.git" ]]; then
echo "Lumbridge repository not found at $repo_path" >&2
exit 1
fi
export DISPLAY=${DISPLAY:-:0}
export XAUTHORITY=${XAUTHORITY:-/run/user/1000/gdm/Xauthority}
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/1000}
export DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS:-unix:path=/run/user/1000/bus}
for command_name in wmctrl xdotool; do
if ! command -v "$command_name" >/dev/null 2>&1; then
echo "required command not found: $command_name" >&2
exit 1
fi
done
if [[ ! -x "$binary_path" ]]; then
if ! command -v cargo >/dev/null 2>&1; then
# Non-login Tailscale SSH commands do not inherit metal's Cargo PATH.
# shellcheck source=/dev/null
source /home/metal/.cargo/env
fi
if ! command -v cargo >/dev/null 2>&1; then
echo "required command not found: cargo" >&2
exit 1
fi
# shellcheck source=/dev/null
source "$repo_path/scripts/native-libs.sh"
cargo build --locked --manifest-path "$manifest_path" -p lumbridge
fi
# GPUI's X11 client sets WM_NAME but not _NET_WM_NAME, so wmctrl's window list
# reports its title as N/A and a title match never succeeds. xdotool reads
# WM_NAME, and matching the launched PID avoids picking up another client that
# merely mentions the window title.
window_for_pid() {
local pid=$1 candidate
for candidate in $(xdotool search --name 'GPUI workspace' 2>/dev/null); do
if [[ "$(xdotool getwindowpid "$candidate" 2>/dev/null || true)" == "$pid" ]]; then
printf '%s\n' "$candidate"
return 0
fi
done
return 1
}
existing_id=''
app_pid=$(pgrep -f "^$binary_path$" | head -n 1 || true)
if [[ -n "$app_pid" ]]; then
existing_id=$(window_for_pid "$app_pid" || true)
fi
if [[ -z "$existing_id" ]]; then
"$binary_path" >"$XDG_RUNTIME_DIR/lumbridge-gpui.log" 2>&1 &
app_pid=$!
for _attempt in $(seq 1 80); do
existing_id=$(window_for_pid "$app_pid" || true)
[[ -n "$existing_id" ]] && break
sleep 0.1
done
fi
if [[ -z "$existing_id" ]]; then
echo "Lumbridge window did not become visible; see $XDG_RUNTIME_DIR/lumbridge-gpui.log" >&2
exit 1
fi
# Gigabyte G34WQC is 3440x1440 at X=0. Lumbridge owns the whole panel: the
# workspace is a wall of agents and every pixel of width buys another column.
# Set LUMBRIDGE_HALF=1 to fall back to the left half beside Bacon.
if [[ "${LUMBRIDGE_HALF:-0}" == "1" ]]; then
bacon_id=$(wmctrl -l | awk -v title="$bacon_title" 'index($0, title) { print $1; exit }')
if [[ -n "$bacon_id" ]]; then
wmctrl -i -r "$bacon_id" -b remove,maximized_vert,maximized_horz
# GNOME's X11 move coordinate is scaled on this display even though window
# sizes are not; 860 places the frame at physical X=1720.
wmctrl -i -r "$bacon_id" -e 0,860,0,1720,1400
fi
wmctrl -i -r "$existing_id" -b remove,fullscreen
wmctrl -i -r "$existing_id" -b remove,maximized_vert,maximized_horz
wmctrl -i -r "$existing_id" -e 0,0,0,1720,1400
wmctrl -i -a "$existing_id"
# GPUI's undecorated X11 client ignores direct position requests under GNOME.
# Use the window manager's move interaction to settle it into the left half.
xdotool key alt+F7
sleep 0.15
xdotool mousemove 860 660 click 1
echo "Lumbridge is on the left half of the Gigabyte display (window $existing_id)."
exit 0
fi
# Fullscreen drops the title bar and the shell owns all 3440x1440. Move it onto
# the Gigabyte first: a fullscreen request applies to whichever output the
# window is currently on, so placing it after would fullscreen the wrong panel.
wmctrl -i -r "$existing_id" -b remove,fullscreen
wmctrl -i -r "$existing_id" -b remove,maximized_vert,maximized_horz
wmctrl -i -r "$existing_id" -e 0,0,0,1720,1400
wmctrl -i -a "$existing_id"
xdotool key alt+F7
sleep 0.15
xdotool mousemove 860 660 click 1
sleep 0.2
wmctrl -i -r "$existing_id" -b add,fullscreen
sleep 0.3
geometry=$(xdotool getwindowgeometry "$existing_id" | awk '/Geometry/ { print $2 }')
echo "Lumbridge is fullscreen on the Gigabyte display at ${geometry} (window $existing_id)."