Rebrand as Playpen.

This commit is contained in:
Greyson Parrelli
2026-08-11 14:26:12 -04:00
parent 3026bdcd4c
commit 73a0187db5
17 changed files with 152 additions and 146 deletions
+26 -26
View File
@@ -10,7 +10,7 @@ description = "Build a debug binary (leak checking, safety checks)"
run = "nix develop --command zig build"
[tasks.run]
description = "Build and run vtabs"
description = "Build and run playpen"
run = "nix develop --command zig build run"
[tasks.fmt]
@@ -18,12 +18,12 @@ description = "Format all Zig source"
run = "nix develop --command zig fmt build.zig src"
[tasks.screenshot]
description = "Screenshot vtabs in a throwaway headless compositor"
description = "Screenshot playpen in a throwaway headless compositor"
depends = ["build-debug"]
run = "nix develop --command ./shot.sh"
[tasks.install]
description = "Install vtabs into ~/.local with a desktop entry and icon"
description = "Install playpen into ~/.local with a desktop entry and icon"
depends = ["build"]
run = '''
#!/usr/bin/env bash
@@ -31,10 +31,10 @@ set -euo pipefail
data="${XDG_DATA_HOME:-$HOME/.local/share}"
bindir="$HOME/.local/bin"
libexec="$HOME/.local/libexec/vtabs"
libexec="$HOME/.local/libexec/playpen"
apps="$data/applications"
icons="$data/icons/hicolor/scalable/apps"
gcroots="$data/vtabs/gcroots"
gcroots="$data/playpen/gcroots"
# The binary carries an RPATH into the Nix store, so it runs anywhere, but it
# still has to be told where GTK's GSettings schemas and icon themes live or
@@ -42,21 +42,21 @@ gcroots="$data/vtabs/gcroots"
# https:// page in a web pane fails, and which mesa to render web panes
# through or WebKit's web process dies on startup. Read those paths back out
# of the dev shell that built it rather than hardcoding store hashes.
schemas="$(nix develop --command printenv VTABS_GSETTINGS_SCHEMA_DIR)"
datadirs="$(nix develop --command printenv VTABS_RUNTIME_DATA_DIRS)"
giomodules="$(nix develop --command printenv VTABS_GIO_MODULE_DIR)"
eglvendor="$(nix develop --command printenv VTABS_EGL_VENDOR_DIR)"
dridrivers="$(nix develop --command printenv VTABS_DRI_DRIVERS_PATH)"
gbmbackends="$(nix develop --command printenv VTABS_GBM_BACKENDS_PATH)"
schemas="$(nix develop --command printenv PLAYPEN_GSETTINGS_SCHEMA_DIR)"
datadirs="$(nix develop --command printenv PLAYPEN_RUNTIME_DATA_DIRS)"
giomodules="$(nix develop --command printenv PLAYPEN_GIO_MODULE_DIR)"
eglvendor="$(nix develop --command printenv PLAYPEN_EGL_VENDOR_DIR)"
dridrivers="$(nix develop --command printenv PLAYPEN_DRI_DRIVERS_PATH)"
gbmbackends="$(nix develop --command printenv PLAYPEN_GBM_BACKENDS_PATH)"
mkdir -p "$bindir" "$libexec" "$apps" "$icons" "$gcroots"
install -m755 zig-out/bin/vtabs "$libexec/vtabs"
install -m755 zig-out/bin/playpen "$libexec/playpen"
# A launcher script rather than a symlink: a desktop launcher starts the app
# with a minimal environment, so the GTK runtime paths must be set here.
# Existing values are preserved so this composes with the rest of the session.
cat > "$bindir/vtabs" <<EOF
cat > "$bindir/playpen" <<EOF
#!/bin/sh
# Generated by \`mise run install\` — re-run that instead of editing.
export GSETTINGS_SCHEMA_DIR="$schemas\${GSETTINGS_SCHEMA_DIR:+:\$GSETTINGS_SCHEMA_DIR}"
@@ -70,13 +70,13 @@ export __EGL_VENDOR_LIBRARY_DIRS="$eglvendor"
export LIBGL_DRIVERS_PATH="$dridrivers"
export GBM_BACKENDS_PATH="$gbmbackends"
exec "$libexec/vtabs" "\$@"
exec "$libexec/playpen" "\$@"
EOF
chmod 755 "$bindir/vtabs"
chmod 755 "$bindir/playpen"
sed "s|@EXEC@|$bindir/vtabs|" dist/dev.greyson.vtabs.desktop.in \
> "$apps/dev.greyson.vtabs.desktop"
install -m644 dist/dev.greyson.vtabs.svg "$icons/dev.greyson.vtabs.svg"
sed "s|@EXEC@|$bindir/playpen|" dist/dev.greyson.playpen.desktop.in \
> "$apps/dev.greyson.playpen.desktop"
install -m644 dist/dev.greyson.playpen.svg "$icons/dev.greyson.playpen.svg"
# Pin the store paths the installed binary links against. Without this a
# later `nix-collect-garbage` deletes GTK and the installed app stops
@@ -86,7 +86,7 @@ rm -f "$gcroots"/*
{
# What the dynamic linker needs, read straight out of the binary.
if command -v readelf >/dev/null; then
readelf -d "$libexec/vtabs" \
readelf -d "$libexec/playpen" \
| sed -n 's/.*R\(UN\)\?PATH.*\[\(.*\)\]/\2/p' \
| tr ':' '\n'
else
@@ -112,7 +112,7 @@ echo "pinned $(find "$gcroots" -maxdepth 1 -type l | wc -l) store paths against
command -v update-desktop-database >/dev/null && update-desktop-database -q "$apps" || true
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -qtf "$data/icons/hicolor" 2>/dev/null || true
echo "installed $bindir/vtabs"
echo "installed $bindir/playpen"
case ":$PATH:" in
*":$bindir:"*) ;;
*) echo "note: $bindir is not on your PATH; the desktop entry still works" >&2 ;;
@@ -128,15 +128,15 @@ set -euo pipefail
data="${XDG_DATA_HOME:-$HOME/.local/share}"
apps="$data/applications"
rm -f "$HOME/.local/bin/vtabs"
rm -rf "$HOME/.local/libexec/vtabs"
rm -f "$apps/dev.greyson.vtabs.desktop"
rm -f "$data/icons/hicolor/scalable/apps/dev.greyson.vtabs.svg"
rm -f "$HOME/.local/bin/playpen"
rm -rf "$HOME/.local/libexec/playpen"
rm -f "$apps/dev.greyson.playpen.desktop"
rm -f "$data/icons/hicolor/scalable/apps/dev.greyson.playpen.svg"
# Dropping the roots lets Nix reclaim the runtime closure on its next GC.
rm -rf "$data/vtabs"
rm -rf "$data/playpen"
command -v update-desktop-database >/dev/null && update-desktop-database -q "$apps" || true
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -qtf "$data/icons/hicolor" 2>/dev/null || true
echo "uninstalled vtabs"
echo "uninstalled playpen"
'''