feat(quickshell): add dense telemetry bar
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(git -C "$(dirname "${BASH_SOURCE[0]}")" rev-parse --show-toplevel)"
|
||||
tool_dir="$repo_root/tools/quickshell-preview"
|
||||
shell_root="$repo_root/dotfiles/quickshell"
|
||||
image="homelab-quickshell-preview:qsmcp-76b1b008"
|
||||
|
||||
component="${1:-tests/HeadlessSmoke.qml}"
|
||||
output="${2:-${TMPDIR:-/tmp}/homelab-quickshell-preview/smoke.png}"
|
||||
width="${3:-720}"
|
||||
height="${4:-120}"
|
||||
|
||||
if ! docker info >/dev/null 2>&1; then
|
||||
echo "error: Docker-compatible daemon is unavailable" >&2
|
||||
exit 69
|
||||
fi
|
||||
|
||||
case "$output" in
|
||||
/*) ;;
|
||||
*) output="$PWD/$output" ;;
|
||||
esac
|
||||
|
||||
output_dir="$(dirname "$output")"
|
||||
output_name="$(basename "$output")"
|
||||
mkdir -p "$output_dir"
|
||||
|
||||
container_id=""
|
||||
cleanup() {
|
||||
if [[ -n "$container_id" ]]; then
|
||||
docker rm --force "$container_id" >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
docker build --tag "$image" --file "$tool_dir/Dockerfile" "$tool_dir"
|
||||
|
||||
container_id="$(docker create \
|
||||
--network none \
|
||||
--tmpfs /tmp:rw,noexec,nosuid,size=256m \
|
||||
"$image" \
|
||||
"$component" \
|
||||
--width "$width" \
|
||||
--height "$height" \
|
||||
--dpr 1 \
|
||||
--padding 0 \
|
||||
--background solid \
|
||||
--bg '#0a0a0a' \
|
||||
--out "/output/$output_name")"
|
||||
|
||||
# docker cp streams files through the API, so this works with rootless and
|
||||
# remote daemons whose filesystem cannot see the client's repository path.
|
||||
docker cp "$shell_root/." "$container_id:/workspace/quickshell"
|
||||
docker start --attach "$container_id"
|
||||
docker cp "$container_id:/output/$output_name" "$output"
|
||||
|
||||
test -s "$output"
|
||||
printf 'rendered=%s\n' "$output"
|
||||
Reference in New Issue
Block a user