hex/scripts/build-capsule-playground.sh
Dax 2962074bfa
Captures on Linux (portal, PipeWire, VA-API); capture compiled into macOS and Linux builds (#320)
* Captures on Linux: portal, PipeWire and VA-API behind the engine's platform seam; capture compiled into macOS and Linux builds

The capture engine's OS adapter gains capture/linux.rs: the screen-cast
portal (zbus) picks the screen (remembered with its restore token) or a
window, libpipewire and libva are loaded at run time, frames are imported
as DMA-BUFs and scaled and H.264-encoded on the GPU, and ffmpeg muxes and
reads movies back. Software x264 is the fallback.

capture_host, the capsule, the pane, routing and the CLI are shared; the
Linux listener feeds a ListenerTimeline, its portal or X11 grabs bind the
capture shortcut, and the summary goes through Hex's Linux clipboard.
The capture feature flag is gone: macOS and Linux always compile the
experiment, off by default.

* Docs: captures on Linux, the experiment in every macOS and Linux build; token path from Hex

* Capture portal: register Hex's app id so the desktop keeps its screen choice

* Fix macOS test build after the capture seam

* Linux: size X11 shortcut state for the capture shortcut; keep macOS-layout capsule tests on macOS

* Windows: the capture word timestamps field is Linux's
2026-10-28 20:58:27 -04:00

37 lines
1.5 KiB
Shell
Executable file

#!/bin/sh
# Builds `Hex Playground.app`: the Scrawl capture capsule in a window of its
# own (`hex capsule-playground`), driven by a fake host with live tuning.
# It touches no Hex data, settings, or captures, and records and sends
# nothing, so it runs beside the installed Hex. Ad-hoc signed, for this Mac.
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
export MACOSX_DEPLOYMENT_TARGET=15.0
cargo build --locked --release --bin hex --manifest-path "$root/Cargo.toml"
target=${CARGO_TARGET_DIR:-$root/target}
bundle="${HEX_PLAYGROUND_OUT:-$root/target/app}/Hex Playground.app"
rm -rf "$bundle"
mkdir -p "$bundle/Contents/MacOS" "$bundle/Contents/Resources"
cp "$target/release/hex" "$bundle/Contents/MacOS/hex"
cat > "$bundle/Contents/MacOS/playground" <<'SH'
#!/bin/sh
exec "$(dirname "$0")/hex" capsule-playground
SH
chmod +x "$bundle/Contents/MacOS/playground"
cat > "$bundle/Contents/Info.plist" <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key><string>playground</string>
<key>CFBundleIdentifier</key><string>anomaly.hex.playground</string>
<key>CFBundleName</key><string>Hex Playground</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0</string>
<key>NSHighResolutionCapable</key><true/>
</dict>
</plist>
PLIST
codesign --force --sign - "$bundle/Contents/MacOS/hex"
codesign --force --sign - "$bundle"
echo "$bundle"