#!/usr/bin/env bash # Launch script for the Wick Editor Electron app. # Standalone: does not require build.sh to have been sourced. Joins the existing # session D-Bus so the AT-SPI tree is visible to the test harness. set -euo pipefail REPO="${REPO:-/workspace/repo}" ELECTRON="$REPO/node_modules/electron/dist/electron" # Display: use the one the pipeline provides; fall back to :0. export DISPLAY="${DISPLAY:-:0}" # node-sass runtime lookups (harmless if unused at runtime, kept for safety). export SASS_BINARY_PATH="${SASS_BINARY_PATH:-/workspace/install/node-sass-binding.node}" # Accessibility: this IS a genuine Electron/Chromium app, so expose the AT-SPI # tree via the renderer accessibility flag. export ELECTRON_ENABLE_ACCESSIBILITY=1 export NO_AT_BRIDGE=0 # Ensure a usable XDG_RUNTIME_DIR (Chromium/D-Bus want one it can write to). if [ -z "${XDG_RUNTIME_DIR:-}" ] || [ ! -w "${XDG_RUNTIME_DIR:-/nonexistent}" ]; then export XDG_RUNTIME_DIR="$(mktemp -d)" chmod 700 "$XDG_RUNTIME_DIR" fi # Unique per-launch user-data-dir so relaunches don't hit the single-instance # lock (the harness starts the app once per test module). USER_DATA_DIR="$(mktemp -d)" # If a session bus address is already exported, JOIN it (do NOT start a private # dbus-run-session — that would hide the AT-SPI tree from the harness). exec "$ELECTRON" "$REPO" \ --no-sandbox \ --force-renderer-accessibility \ --user-data-dir="$USER_DATA_DIR" \ --disable-gpu \ "$@"