Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(dev-vm): dense HiDPI display by default (1920x1200 via displayplacer, refit + maximized window)

Louis Beaumont5f162c033ba9
diff --git a/scripts/dev-vm/README.md b/scripts/dev-vm/README.md
index db28d12cd..4eaeb820e 100644
--- a/scripts/dev-vm/README.md
+++ b/scripts/dev-vm/README.md
@@ -10,7 +10,7 @@ A scripted macOS VM (via [tart](https://tart.run), Apple Virtualization.framewor
./scripts/dev-vm/ssh.sh # shell into it
```
-Defaults: `screenpipe-dev` VM, 8 CPU, 16GB RAM, 80GB sparse disk, macOS Tahoe base image. Override with env vars: `VM_NAME`, `IMAGE`, `VM_CPU`, `VM_MEM`, `VM_DISK`.
+Defaults: `screenpipe-dev` VM, 8 CPU, 16GB RAM, 80GB sparse disk, macOS Tahoe base image, guest display 1920x1200 HiDPI (set via displayplacer; override with `GUEST_RES`), window opens maximized (`VM_WINDOW=keep` to skip) with `--display-refit` so resizing the window re-fits the guest. Other overrides: `VM_NAME`, `IMAGE`, `VM_CPU`, `VM_MEM`, `VM_DISK`, `VM_DISPLAY`.
## What gets installed in the guest
diff --git a/scripts/dev-vm/provision.sh b/scripts/dev-vm/provision.sh
index 24efb1859..fb4c3bd32 100755
--- a/scripts/dev-vm/provision.sh
+++ b/scripts/dev-vm/provision.sh
@@ -97,6 +97,18 @@ cat > "$HOME/Library/LaunchAgents/pe.screenpi.devvm.claude.plist" <<'PLIST'
PLIST
launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/pe.screenpi.devvm.claude.plist" 2>/dev/null || true
+# guest display resolution (HiDPI). the tart-side --display/--display-refit config
+# defines the virtual display; the guest still boots at a small scaled mode, so we
+# pin a dense one here. override with GUEST_RES, e.g. GUEST_RES=2560x1600.
+GUEST_RES="${GUEST_RES:-1920x1200}"
+log "setting display to ${GUEST_RES} HiDPI..."
+brew install --quiet displayplacer >/dev/null 2>&1 || true
+SID=$(displayplacer list 2>/dev/null | awk '/Persistent screen id/{print $4}')
+if [ -n "$SID" ]; then
+ displayplacer "id:${SID} res:${GUEST_RES} hz:60 color_depth:7 scaling:on origin:(0,0) degree:0" \
+ || log "displayplacer could not set ${GUEST_RES}; keeping current mode"
+fi
+
log "versions:"
echo " rustc: $(rustc --version 2>/dev/null || echo missing)"
echo " cargo: $(cargo --version 2>/dev/null || echo missing)"
diff --git a/scripts/dev-vm/run.sh b/scripts/dev-vm/run.sh
index b0b7dbbc4..57d473d32 100755
--- a/scripts/dev-vm/run.sh
+++ b/scripts/dev-vm/run.sh
@@ -16,6 +16,21 @@ if pgrep -f "tart run ${VM_NAME}" >/dev/null 2>&1; then
exit 1
fi
+# maximize the window by default: with --display-refit the guest resolution follows
+# the window, so a big window = big resolution (small UI). tart restores the last
+# window frame from its prefs; the stored value embeds the host screen size, which
+# we reuse to write a full-screen frame. VM_WINDOW=keep skips this.
+TART_FRAME_KEY='NSWindow Frame SwiftUI.ModifiedContent<SwiftUI.Group<SwiftUI.ModifiedContent<SwiftUI.ModifiedContent<tart.VMView, SwiftUI._AppearanceActionModifier>, SwiftUI._AppearanceActionModifier>>, SwiftUI._FlexFrameLayout>-1-AppWindow-1'
+if [ "${VM_WINDOW:-max}" = "max" ]; then
+ frame=$(defaults read tart "$TART_FRAME_KEY" 2>/dev/null || true)
+ if [ -n "$frame" ]; then
+ read -r _ _ _ _ _ _ sw sh <<<"$frame"
+ if [ "${sw:-0}" -gt 0 ] 2>/dev/null && [ "${sh:-0}" -gt 0 ] 2>/dev/null; then
+ defaults write tart "$TART_FRAME_KEY" "0 25 $sw $((sh-25)) 0 0 $sw $sh "
+ fi
+ fi
+fi
+
ARGS=()
if [ "${SHARE_REPO:-0}" = "1" ]; then
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
diff --git a/scripts/dev-vm/setup.sh b/scripts/dev-vm/setup.sh
index 24a8179c1..8f22cc747 100755
--- a/scripts/dev-vm/setup.sh
+++ b/scripts/dev-vm/setup.sh
@@ -19,6 +19,7 @@ IMAGE="${IMAGE:-ghcr.io/cirruslabs/macos-tahoe-base:latest}"
VM_CPU="${VM_CPU:-8}"
VM_MEM="${VM_MEM:-16384}" # MB
VM_DISK="${VM_DISK:-80}" # GB (sparse: only used space hits the host disk)
+VM_DISPLAY="${VM_DISPLAY:-2560x1600}" # points (HiDPI); refit keeps it matched to the window
SSH_KEY="$HOME/.ssh/${VM_NAME}-vm"
SSH_OPTS=(-i "$SSH_KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -49,7 +50,7 @@ fi
if ! tart list --quiet | grep -qx "$VM_NAME"; then
log "cloning $IMAGE -> $VM_NAME"
tart clone "$IMAGE" "$VM_NAME"
- tart set "$VM_NAME" --cpu "$VM_CPU" --memory "$VM_MEM" --disk-size "$VM_DISK"
+ tart set "$VM_NAME" --cpu "$VM_CPU" --memory "$VM_MEM" --disk-size "$VM_DISK" --display "$VM_DISPLAY" --display-refit
fi
# 4. boot headless if not running (`tart ip` returns a stale lease when stopped; check the process)