Bundle WayVR Dashboard into wlx, find wayvr-dashboard executable in AppImage (if exists) (#208) (#210)
Co-authored-by: Aleksander <aleksander@oo8.dev>
This commit is contained in:
23
.github/workflows/build-appimage.yml
vendored
23
.github/workflows/build-appimage.yml
vendored
@@ -21,30 +21,13 @@ jobs:
|
|||||||
uses: mozilla-actions/sccache-action@v0.0.9
|
uses: mozilla-actions/sccache-action@v0.0.9
|
||||||
- name: Prepare Environment
|
- name: Prepare Environment
|
||||||
run: |
|
run: |
|
||||||
sudo add-apt-repository -syn universe
|
.github/workflows/scripts/appimage_prepare_env.sh
|
||||||
sudo add-apt-repository -syn ppa:pipewire-debian/pipewire-upstream || sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 25088A0359807596
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y fuse cmake pkg-config fontconfig libasound2-dev libxkbcommon-dev libxkbcommon-x11-0 libxkbcommon-x11-dev libopenxr-dev libfontconfig-dev libdbus-1-dev libpipewire-0.3-0 libpipewire-0.3-dev libspa-0.2-dev libx11-6 libxext6 libxrandr2 libx11-dev libxext-dev libxrandr-dev libopenvr-dev libopenvr-api1 libwayland-dev libegl-dev
|
|
||||||
rustup update
|
|
||||||
|
|
||||||
test -f linuxdeploy-x86_64.AppImage || wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
|
||||||
chmod +x linuxdeploy-x86_64.AppImage
|
|
||||||
|
|
||||||
test -d ${APPDIR} && rm -rf ${APPDIR}
|
|
||||||
mkdir -p ${APPDIR}/usr/bin
|
|
||||||
|
|
||||||
- name: Cargo Build
|
- name: Cargo Build
|
||||||
run: |
|
run: |
|
||||||
cargo build --release
|
.github/workflows/scripts/appimage_build_wlx.sh
|
||||||
mv target/release/wlx-overlay-s ${APPDIR}/usr/bin
|
|
||||||
chmod +x ${APPDIR}/usr/bin/wlx-overlay-s
|
|
||||||
|
|
||||||
- name: Package AppImage
|
- name: Package AppImage
|
||||||
run: |
|
run: |
|
||||||
export VERSION=$GITHUB_REF_NAME
|
.github/workflows/scripts/appimage_package.sh
|
||||||
./linuxdeploy-x86_64.AppImage -dwlx-overlay-s.desktop -iwlx-overlay-s.png --appdir=${APPDIR} --output appimage --exclude-library '*libpipewire*'
|
|
||||||
mv WlxOverlay-S-$VERSION-x86_64.AppImage WlxOverlay-S-x86_64.AppImage
|
|
||||||
|
|
||||||
- name: Upload AppImage
|
- name: Upload AppImage
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
38
.github/workflows/build-full-appimage.yml
vendored
Normal file
38
.github/workflows/build-full-appimage.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Build AppImage (with WayVR Dashboard)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'staging'
|
||||||
|
|
||||||
|
env:
|
||||||
|
APPDIR: WlxOverlay-S-Full.AppDir
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
SCCACHE_GHA_ENABLED: "true"
|
||||||
|
RUSTC_WRAPPER: "sccache"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_appimage:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup sccache
|
||||||
|
uses: mozilla-actions/sccache-action@v0.0.9
|
||||||
|
- name: Prepare Environment
|
||||||
|
run: |
|
||||||
|
.github/workflows/scripts/appimage_prepare_env.sh
|
||||||
|
- name: Cargo Build
|
||||||
|
run: |
|
||||||
|
.github/workflows/scripts/appimage_build_wlx.sh
|
||||||
|
- name: Build WayVR Dashboard
|
||||||
|
run: |
|
||||||
|
.github/workflows/scripts/appimage_build_wayvr_dashboard.sh
|
||||||
|
- name: Package AppImage
|
||||||
|
run: |
|
||||||
|
.github/workflows/scripts/appimage_package_full.sh
|
||||||
|
- name: Upload AppImage
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: WlxOverlay-S-Full-${{ github.ref_name }}-x86_64.AppImage
|
||||||
|
path: ./WlxOverlay-S-Full-x86_64.AppImage
|
||||||
34
.github/workflows/scripts/appimage_build_wayvr_dashboard.sh
vendored
Executable file
34
.github/workflows/scripts/appimage_build_wayvr_dashboard.sh
vendored
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
git clone --depth=1 https://github.com/olekolek1000/wayvr-dashboard.git wayvr-dashboard
|
||||||
|
|
||||||
|
WLX_DIR=$(realpath $(pwd))
|
||||||
|
|
||||||
|
cd wayvr-dashboard
|
||||||
|
.github/workflows/build.sh
|
||||||
|
|
||||||
|
# See https://github.com/olekolek1000/wayvr-dashboard/blob/master/.github/workflows/appimage.sh
|
||||||
|
cd ..
|
||||||
|
cd ${APPDIR}
|
||||||
|
|
||||||
|
# Fix webkit
|
||||||
|
echo "Copying webkit runtime executables"
|
||||||
|
|
||||||
|
# Copy runtime executables
|
||||||
|
find -L /usr/lib /usr/libexec -name WebKitNetworkProcess -exec mkdir -p . ';' -exec cp -v --parents '{}' . ';' || true
|
||||||
|
find -L /usr/lib /usr/libexec -name WebKitWebProcess -exec mkdir -p . ';' -exec cp -v --parents '{}' . ';' || true
|
||||||
|
find -L /usr/lib /usr/libexec -name libwebkit2gtkinjectedbundle.so -exec mkdir -p . ';' -exec cp --parents '{}' . ';' || true
|
||||||
|
|
||||||
|
echo "Patching webkit lib"
|
||||||
|
|
||||||
|
# Patch libwebkit .so file: Replace 4 bytes containing "/usr" into "././". Required!
|
||||||
|
TARGET_WEBKIT_SO="./usr/lib/libwebkit2gtk-4.1.so.0"
|
||||||
|
cp /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0 ${TARGET_WEBKIT_SO}
|
||||||
|
sed -i -e "s|/usr|././|g" "${TARGET_WEBKIT_SO}"
|
||||||
|
|
||||||
|
cd ${WLX_DIR}
|
||||||
|
|
||||||
|
DASH_PATH="${WLX_DIR}/wayvr-dashboard/temp/wayvr-dashboard"
|
||||||
|
chmod +x ${DASH_PATH}
|
||||||
|
|
||||||
|
# Put resulting executable into wlx AppDir
|
||||||
|
cp ${DASH_PATH} ${APPDIR}/usr/bin/wayvr-dashboard
|
||||||
4
.github/workflows/scripts/appimage_build_wlx.sh
vendored
Executable file
4
.github/workflows/scripts/appimage_build_wlx.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cargo build --release
|
||||||
|
mv target/release/wlx-overlay-s ${APPDIR}/usr/bin
|
||||||
|
chmod +x ${APPDIR}/usr/bin/wlx-overlay-s
|
||||||
4
.github/workflows/scripts/appimage_package.sh
vendored
Executable file
4
.github/workflows/scripts/appimage_package.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export VERSION=$GITHUB_REF_NAME
|
||||||
|
./linuxdeploy-x86_64.AppImage -dwlx-overlay-s.desktop -iwlx-overlay-s.png --appdir=${APPDIR} --output appimage --exclude-library '*libpipewire*'
|
||||||
|
mv WlxOverlay-S-$VERSION-x86_64.AppImage WlxOverlay-S-x86_64.AppImage
|
||||||
4
.github/workflows/scripts/appimage_package_full.sh
vendored
Executable file
4
.github/workflows/scripts/appimage_package_full.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export VERSION=$GITHUB_REF_NAME
|
||||||
|
./linuxdeploy-x86_64.AppImage -dwlx-overlay-s.desktop -iwlx-overlay-s.png --appdir=${APPDIR} --output appimage --exclude-library '*libpipewire*'
|
||||||
|
mv WlxOverlay-S-$VERSION-x86_64.AppImage WlxOverlay-S-Full-x86_64.AppImage
|
||||||
13
.github/workflows/scripts/appimage_prepare_env.sh
vendored
Executable file
13
.github/workflows/scripts/appimage_prepare_env.sh
vendored
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sudo add-apt-repository -syn universe
|
||||||
|
sudo add-apt-repository -syn ppa:pipewire-debian/pipewire-upstream || sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 25088A0359807596
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y fuse cmake pkg-config fontconfig libasound2-dev libxkbcommon-dev libxkbcommon-x11-0 libxkbcommon-x11-dev libopenxr-dev libfontconfig-dev libdbus-1-dev libpipewire-0.3-0 libpipewire-0.3-dev libspa-0.2-dev libx11-6 libxext6 libxrandr2 libx11-dev libxext-dev libxrandr-dev libopenvr-dev libopenvr-api1 libwayland-dev libegl-dev
|
||||||
|
rustup update
|
||||||
|
|
||||||
|
test -f linuxdeploy-x86_64.AppImage || wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
||||||
|
chmod +x linuxdeploy-x86_64.AppImage
|
||||||
|
|
||||||
|
test -d ${APPDIR} && rm -rf ${APPDIR}
|
||||||
|
mkdir -p ${APPDIR}/usr/bin
|
||||||
@@ -556,6 +556,7 @@ impl Display {
|
|||||||
exec_path: &str,
|
exec_path: &str,
|
||||||
args: &[&str],
|
args: &[&str],
|
||||||
env: &[(&str, &str)],
|
env: &[(&str, &str)],
|
||||||
|
working_dir: Option<&str>,
|
||||||
) -> anyhow::Result<SpawnProcessResult> {
|
) -> anyhow::Result<SpawnProcessResult> {
|
||||||
log::info!("Spawning subprocess with exec path \"{exec_path}\"");
|
log::info!("Spawning subprocess with exec path \"{exec_path}\"");
|
||||||
|
|
||||||
@@ -564,6 +565,9 @@ impl Display {
|
|||||||
let mut cmd = std::process::Command::new(exec_path);
|
let mut cmd = std::process::Command::new(exec_path);
|
||||||
self.configure_env(&mut cmd, auth_key.as_str());
|
self.configure_env(&mut cmd, auth_key.as_str());
|
||||||
cmd.args(args);
|
cmd.args(args);
|
||||||
|
if let Some(working_dir) = working_dir {
|
||||||
|
cmd.current_dir(working_dir);
|
||||||
|
}
|
||||||
|
|
||||||
for e in env {
|
for e in env {
|
||||||
cmd.env(e.0, e.1);
|
cmd.env(e.0, e.1);
|
||||||
|
|||||||
@@ -684,6 +684,7 @@ impl WayVRState {
|
|||||||
exec_path: &str,
|
exec_path: &str,
|
||||||
args: &[&str],
|
args: &[&str],
|
||||||
env: &[(&str, &str)],
|
env: &[(&str, &str)],
|
||||||
|
working_dir: Option<&str>,
|
||||||
userdata: HashMap<String, String>,
|
userdata: HashMap<String, String>,
|
||||||
) -> anyhow::Result<process::ProcessHandle> {
|
) -> anyhow::Result<process::ProcessHandle> {
|
||||||
let display = self
|
let display = self
|
||||||
@@ -691,7 +692,7 @@ impl WayVRState {
|
|||||||
.get_mut(&display_handle)
|
.get_mut(&display_handle)
|
||||||
.ok_or_else(|| anyhow::anyhow!(STR_INVALID_HANDLE_DISP))?;
|
.ok_or_else(|| anyhow::anyhow!(STR_INVALID_HANDLE_DISP))?;
|
||||||
|
|
||||||
let res = display.spawn_process(exec_path, args, env)?;
|
let res = display.spawn_process(exec_path, args, env, working_dir)?;
|
||||||
|
|
||||||
let handle = self
|
let handle = self
|
||||||
.processes
|
.processes
|
||||||
@@ -702,6 +703,7 @@ impl WayVRState {
|
|||||||
exec_path: String::from(exec_path),
|
exec_path: String::from(exec_path),
|
||||||
userdata,
|
userdata,
|
||||||
args: args.iter().map(|x| String::from(*x)).collect(),
|
args: args.iter().map(|x| String::from(*x)).collect(),
|
||||||
|
working_dir: working_dir.map(String::from),
|
||||||
env: env
|
env: env
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(a, b)| (String::from(*a), String::from(*b)))
|
.map(|(a, b)| (String::from(*a), String::from(*b)))
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ pub struct WayVRProcess {
|
|||||||
pub exec_path: String,
|
pub exec_path: String,
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
pub env: Vec<(String, String)>,
|
pub env: Vec<(String, String)>,
|
||||||
|
pub working_dir: Option<String>,
|
||||||
|
|
||||||
pub userdata: HashMap<String, String>,
|
pub userdata: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ impl Connection {
|
|||||||
&packet_params.exec,
|
&packet_params.exec,
|
||||||
&args_vec,
|
&args_vec,
|
||||||
&env_vec,
|
&env_vec,
|
||||||
|
None,
|
||||||
packet_params.userdata,
|
packet_params.userdata,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use crate::{
|
|||||||
config::load_config_with_conf_d,
|
config::load_config_with_conf_d,
|
||||||
config_io,
|
config_io,
|
||||||
gui::modular::button::WayVRAction,
|
gui::modular::button::WayVRAction,
|
||||||
overlays::wayvr::WayVRData,
|
overlays::wayvr::{executable_exists_in_path, WayVRData},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flat version of RelativeTo
|
// Flat version of RelativeTo
|
||||||
@@ -120,6 +120,7 @@ fn def_blit_method() -> String {
|
|||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
pub struct WayVRDashboard {
|
pub struct WayVRDashboard {
|
||||||
pub exec: String,
|
pub exec: String,
|
||||||
|
pub working_dir: Option<String>,
|
||||||
pub args: Option<String>,
|
pub args: Option<String>,
|
||||||
pub env: Option<Vec<String>>,
|
pub env: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
@@ -234,6 +235,21 @@ impl WayVRConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_default_dashboard_exec() -> (
|
||||||
|
String, /* exec path */
|
||||||
|
Option<String>, /* working directory */
|
||||||
|
) {
|
||||||
|
if let Ok(appdir) = std::env::var("APPDIR") {
|
||||||
|
// Running in AppImage
|
||||||
|
let embedded_path = format!("{appdir}/usr/bin/wayvr-dashboard");
|
||||||
|
if executable_exists_in_path(&embedded_path) {
|
||||||
|
log::info!("Using WayVR Dashboard from AppDir: {embedded_path}");
|
||||||
|
return (embedded_path, Some(format!("{appdir}/usr")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(String::from("wayvr-dashboard"), None)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn load_wayvr() -> WayVRConfig {
|
pub fn load_wayvr() -> WayVRConfig {
|
||||||
let config_root_path = config_io::ConfigRoot::WayVR.ensure_dir();
|
let config_root_path = config_io::ConfigRoot::WayVR.ensure_dir();
|
||||||
log::info!("WayVR Config root path: {}", config_root_path.display());
|
log::info!("WayVR Config root path: {}", config_root_path.display());
|
||||||
@@ -242,5 +258,19 @@ pub fn load_wayvr() -> WayVRConfig {
|
|||||||
config_io::ConfigRoot::WayVR.get_conf_d_path().display()
|
config_io::ConfigRoot::WayVR.get_conf_d_path().display()
|
||||||
);
|
);
|
||||||
|
|
||||||
load_config_with_conf_d::<WayVRConfig>("wayvr.yaml", config_io::ConfigRoot::WayVR)
|
let mut conf =
|
||||||
|
load_config_with_conf_d::<WayVRConfig>("wayvr.yaml", config_io::ConfigRoot::WayVR);
|
||||||
|
|
||||||
|
if conf.dashboard.is_none() {
|
||||||
|
let (exec, working_dir) = get_default_dashboard_exec();
|
||||||
|
|
||||||
|
conf.dashboard = Some(WayVRDashboard {
|
||||||
|
args: None,
|
||||||
|
env: None,
|
||||||
|
exec,
|
||||||
|
working_dir,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
conf
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ fn get_or_create_display_by_name(
|
|||||||
Ok(disp_handle)
|
Ok(disp_handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn executable_exists_in_path(command: &str) -> bool {
|
pub fn executable_exists_in_path(command: &str) -> bool {
|
||||||
let Ok(path) = std::env::var("PATH") else {
|
let Ok(path) = std::env::var("PATH") else {
|
||||||
return false; // very unlikely to happen
|
return false; // very unlikely to happen
|
||||||
};
|
};
|
||||||
@@ -270,14 +270,9 @@ fn toggle_dashboard<O>(
|
|||||||
where
|
where
|
||||||
O: Default,
|
O: Default,
|
||||||
{
|
{
|
||||||
let conf_dash = app.session.wayvr_config.dashboard.clone().map_or_else(
|
let Some(conf_dash) = app.session.wayvr_config.dashboard.clone() else {
|
||||||
|| config_wayvr::WayVRDashboard {
|
anyhow::bail!("Dashboard is not configured");
|
||||||
exec: String::from("wayvr-dashboard"),
|
};
|
||||||
args: None,
|
|
||||||
env: None,
|
|
||||||
},
|
|
||||||
|conf| conf,
|
|
||||||
);
|
|
||||||
|
|
||||||
if !wayvr.dashboard_executed && !executable_exists_in_path(&conf_dash.exec) {
|
if !wayvr.dashboard_executed && !executable_exists_in_path(&conf_dash.exec) {
|
||||||
anyhow::bail!("Executable \"{}\" not found", &conf_dash.exec);
|
anyhow::bail!("Executable \"{}\" not found", &conf_dash.exec);
|
||||||
@@ -317,10 +312,6 @@ where
|
|||||||
overlay.state.z_order = Z_ORDER_DASHBOARD;
|
overlay.state.z_order = Z_ORDER_DASHBOARD;
|
||||||
overlay.state.reset(app, true);
|
overlay.state.reset(app, true);
|
||||||
|
|
||||||
let Some(conf_dash) = &app.session.wayvr_config.dashboard else {
|
|
||||||
unreachable!(); /* safe, not possible to trigger */
|
|
||||||
};
|
|
||||||
|
|
||||||
overlays.add(overlay);
|
overlays.add(overlay);
|
||||||
|
|
||||||
let args_vec = &conf_dash
|
let args_vec = &conf_dash
|
||||||
@@ -342,6 +333,7 @@ where
|
|||||||
&conf_dash.exec,
|
&conf_dash.exec,
|
||||||
args_vec,
|
args_vec,
|
||||||
env_vec,
|
env_vec,
|
||||||
|
conf_dash.working_dir.as_deref(),
|
||||||
userdata,
|
userdata,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
@@ -879,6 +871,7 @@ where
|
|||||||
&app_entry.exec,
|
&app_entry.exec,
|
||||||
args_vec,
|
args_vec,
|
||||||
env_vec,
|
env_vec,
|
||||||
|
None,
|
||||||
HashMap::default(),
|
HashMap::default(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user