2026-07-16 17:24:50 +03:00
|
|
|
#!/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}"
|
2026-07-17 19:35:08 +03:00
|
|
|
# gtk4-layer-shell must load before libwayland-client or its Wayland shim is
|
|
|
|
|
# skipped and the overlay sits as an unpositioned normal window.
|
|
|
|
|
layer_shell_lib="$(pkg-config --variable=libdir gtk4-layer-shell-0)/libgtk4-layer-shell.so.0"
|
|
|
|
|
if [[ -f "$layer_shell_lib" ]]; then
|
|
|
|
|
export LD_PRELOAD="${layer_shell_lib}${LD_PRELOAD:+:$LD_PRELOAD}"
|
|
|
|
|
fi
|
|
|
|
|
export CGO_LDFLAGS="-Wl,--no-as-needed -lgtk4-layer-shell ${CGO_LDFLAGS:-}"
|
2026-07-16 17:24:50 +03:00
|
|
|
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" "$@"
|