forked from 1b-agent/opencadstudio-upstream
Strict confinement uses a private runtime directory while the Wayland socket remains in the host directory. Resolve the accessible socket path, provide bundled XKB data, and fall back to X11 only when needed.
22 lines
631 B
Bash
22 lines
631 B
Bash
#!/bin/sh
|
|
|
|
export XKB_CONFIG_ROOT="$SNAP/usr/share/X11/xkb"
|
|
|
|
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
|
case "$WAYLAND_DISPLAY" in
|
|
/*) wayland_socket="$WAYLAND_DISPLAY" ;;
|
|
*)
|
|
wayland_socket="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"
|
|
host_socket="${XDG_RUNTIME_DIR%/*}/$WAYLAND_DISPLAY"
|
|
if [ ! -S "$wayland_socket" ] && [ -S "$host_socket" ]; then
|
|
WAYLAND_DISPLAY="$host_socket"
|
|
export WAYLAND_DISPLAY
|
|
wayland_socket="$host_socket"
|
|
fi
|
|
;;
|
|
esac
|
|
[ -S "$wayland_socket" ] || unset WAYLAND_DISPLAY
|
|
fi
|
|
|
|
exec "$@"
|