#!/usr/bin/env bash set -Eeuo pipefail script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=scripts/distrobox/common.sh source "$script_dir/common.sh" prepare_distrobox # shellcheck disable=SC2016 # This script is evaluated inside the container. run_script='set -Eeuo pipefail repo_root=$1 shift cd -- "$repo_root" # Avoid host/container DMABUF incompatibilities on mismatched GPU stacks. An # explicit GTK renderer choice still takes precedence. export GSK_RENDERER="${GSK_RENDERER:-cairo}" # gtk4-layer-shell must precede libwayland-client in the link line. Do NOT # LD_PRELOAD it here: the shim breaks the main GtkApplication window on # Wayland when forced onto the whole process. export CGO_LDFLAGS="-Wl,--no-as-needed -lgtk4-layer-shell ${CGO_LDFLAGS:-}" desktop_bin=build/captioneer-desktop if [[ -x "$desktop_bin" ]]; then printf "captioneer: launching %s\\n" "$desktop_bin" >&2 exec "./$desktop_bin" "$@" fi printf "captioneer: no build/captioneer-desktop yet; compiling with go run (first launch is slow)\\n" >&2 exec go run -tags gtk ./src/cmd/captioneer-desktop "$@"' exec distrobox enter --no-workdir --name "$container_name" -- \ bash -lc "$run_script" captioneer-run "$repo_root" "$@"