From 6df23ad8c224bd2a499f84418b279f487279a5c1 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Sun, 16 Aug 2026 09:13:18 +0300 Subject: [PATCH] fix(snap): handle desktop runtime paths 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. --- snap/local/open-cad-studio-wrapper | 21 +++++++++++++++++++++ snap/snapcraft.yaml | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 snap/local/open-cad-studio-wrapper diff --git a/snap/local/open-cad-studio-wrapper b/snap/local/open-cad-studio-wrapper new file mode 100644 index 00000000..07eda266 --- /dev/null +++ b/snap/local/open-cad-studio-wrapper @@ -0,0 +1,21 @@ +#!/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 "$@" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 9973cf30..088f3265 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -54,6 +54,7 @@ layout: apps: open-cad-studio: command-chain: + - bin/open-cad-studio-wrapper - bin/graphics-core22-wrapper command: usr/bin/OpenCADStudio desktop: usr/share/applications/io.github.HakanSeven12.OpenCadStudio.desktop @@ -74,6 +75,8 @@ parts: override-build: | mkdir -p "${CRAFT_PART_INSTALL}" tar -xzf "${CRAFT_PROJECT_DIR}/linux-payload.tar.gz" -C "${CRAFT_PART_INSTALL}" + install -Dm755 "${CRAFT_PROJECT_DIR}/snap/local/open-cad-studio-wrapper" \ + "${CRAFT_PART_INSTALL}/bin/open-cad-studio-wrapper" stage-packages: - libxcursor1 - libxi6