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.
This commit is contained in:
parent
ca959a31e0
commit
6df23ad8c2
2 changed files with 24 additions and 0 deletions
21
snap/local/open-cad-studio-wrapper
Normal file
21
snap/local/open-cad-studio-wrapper
Normal file
|
|
@ -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 "$@"
|
||||||
|
|
@ -54,6 +54,7 @@ layout:
|
||||||
apps:
|
apps:
|
||||||
open-cad-studio:
|
open-cad-studio:
|
||||||
command-chain:
|
command-chain:
|
||||||
|
- bin/open-cad-studio-wrapper
|
||||||
- bin/graphics-core22-wrapper
|
- bin/graphics-core22-wrapper
|
||||||
command: usr/bin/OpenCADStudio
|
command: usr/bin/OpenCADStudio
|
||||||
desktop: usr/share/applications/io.github.HakanSeven12.OpenCadStudio.desktop
|
desktop: usr/share/applications/io.github.HakanSeven12.OpenCadStudio.desktop
|
||||||
|
|
@ -74,6 +75,8 @@ parts:
|
||||||
override-build: |
|
override-build: |
|
||||||
mkdir -p "${CRAFT_PART_INSTALL}"
|
mkdir -p "${CRAFT_PART_INSTALL}"
|
||||||
tar -xzf "${CRAFT_PROJECT_DIR}/linux-payload.tar.gz" -C "${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:
|
stage-packages:
|
||||||
- libxcursor1
|
- libxcursor1
|
||||||
- libxi6
|
- libxi6
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue