diff --git a/.github/workflows/build-appimage.yml b/.github/workflows/build-appimage.yml index 4776d417..a973405a 100644 --- a/.github/workflows/build-appimage.yml +++ b/.github/workflows/build-appimage.yml @@ -29,6 +29,9 @@ jobs: - name: Cargo Build run: | ../.github/workflows/scripts/appimage_build_wlx.sh + - name: Build xwayland-satellite + run: | + ../.github/workflows/scripts/appimage_build_satellite.sh - name: Package AppImage run: | ../.github/workflows/scripts/appimage_package.sh diff --git a/.github/workflows/scripts/appimage_build_satellite.sh b/.github/workflows/scripts/appimage_build_satellite.sh new file mode 100755 index 00000000..8810f47a --- /dev/null +++ b/.github/workflows/scripts/appimage_build_satellite.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +sudo apt install \ + xwayland \ + libxcb1-dev \ + libxcb-cursor-dev \ + clang \ + pkg-config + +git clone https://github.com/Supreeeme/xwayland-satellite.git +cd xwayland-satellite + +cargo build --release +chmod +x ../target/release/xwayland-satellite +cd .. + +cp xwayland-satellite/target/release/xwayland-satellite ${APPDIR}/usr/bin diff --git a/wayvr/src/backend/wayvr/client.rs b/wayvr/src/backend/wayvr/client.rs index 1719e39e..6144a0b5 100644 --- a/wayvr/src/backend/wayvr/client.rs +++ b/wayvr/src/backend/wayvr/client.rs @@ -1,4 +1,5 @@ use std::{ + ffi::OsStr, io::Read, os::unix::net::UnixStream, path::PathBuf, @@ -97,7 +98,7 @@ impl WayVRCompositor { ) -> anyhow::Result { let (wayland_env, listener) = create_wayland_listener()?; - let xwayland_satellite = Command::new("xwayland-satellite") + let xwayland_satellite = Command::new(bundled_executable("xwayland-satellite")) .arg(wayland_env.display_num_string()) .env("WAYLAND_DISPLAY", wayland_env.wayland_display_num_string()) .spawn() @@ -392,3 +393,11 @@ fn accumulate_discrete_scroll(acc: &mut f32, delta_v120: i32) -> i32 { steps } + +/// Runs executable from APPDIR, falling back to PATH +fn bundled_executable(name: impl AsRef) -> PathBuf { + match std::env::var_os("APPDIR") { + Some(appdir) => PathBuf::from(appdir).join("usr").join("bin").join(name), + None => PathBuf::from(name.as_ref()), + } +}