diff --git a/nix/devShell.nix b/nix/devShell.nix index a1352de33e..10791e3a14 100644 --- a/nix/devShell.nix +++ b/nix/devShell.nix @@ -41,6 +41,11 @@ # libglvnd provides libEGL.so.1 that cage needs on NixOS. cage libglvnd + # Graphical terminal + Wayland screenshot client for CLI/TUI UI + # evidence. `cage -- ghostty ...` keeps captures off the user's + # live compositor; grim runs inside that isolated client session. + ghostty + grim ] ++ self'.packages.default.passthru.devDeps; shellHook = '' diff --git a/scripts/capture-cage-terminal.sh b/scripts/capture-cage-terminal.sh new file mode 100755 index 0000000000..0a30ff08dc --- /dev/null +++ b/scripts/capture-cage-terminal.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +out=${1:?usage: $0 OUTPUT.png [command...]} +shift +mkdir -p "$(dirname "$out")" + +# This runs inside `cage --`, after Ghostty has already opened the isolated +# Wayland display. Capture before this script exits so Cage keeps the surface +# alive long enough for grim to see it. +if (($#)); then + "$@" +fi +if ! command -v grim >/dev/null 2>&1; then + echo "grim is required inside the Cage client session" >&2 + exit 127 +fi +grim "$out"