From c799ecea934cce8f797ca62b2f4518b705d748e5 Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Fri, 9 Jan 2026 20:27:20 +0900 Subject: [PATCH] fix features --- .../build-wayland-openxr-openvr-wayvr.yml | 28 --- dash-frontend/Cargo.toml | 4 + dash-frontend/src/frontend.rs | 5 +- uidev/src/testbed/testbed_dashboard.rs | 1 + wlx-capture/src/frame.rs | 11 +- wlx-capture/src/wlr_screencopy.rs | 11 +- wlx-overlay-s/contrib/wayvr/README.md | 48 ---- .../contrib/wayvr/watch_wayvr_example.yaml | 207 ------------------ wlx-overlay-s/src/config.rs | 9 +- wlx-overlay-s/src/overlays/dashboard.rs | 30 +++ wlx-overlay-s/src/overlays/screen/capture.rs | 3 +- wlx-overlay-s/src/res/wayvr.yaml | 75 ------- 12 files changed, 52 insertions(+), 380 deletions(-) delete mode 100644 .github/workflows/build-wayland-openxr-openvr-wayvr.yml delete mode 100644 wlx-overlay-s/contrib/wayvr/watch_wayvr_example.yaml delete mode 100644 wlx-overlay-s/src/res/wayvr.yaml diff --git a/.github/workflows/build-wayland-openxr-openvr-wayvr.yml b/.github/workflows/build-wayland-openxr-openvr-wayvr.yml deleted file mode 100644 index cd37e97..0000000 --- a/.github/workflows/build-wayland-openxr-openvr-wayvr.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Check Wayland+OpenXR+OpenVR+WayVR - -on: - pull_request: - #branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: "sccache" - -jobs: - build: - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ./wlx-overlay-s - steps: - - uses: actions/checkout@v4 - - name: Setup sccache - uses: mozilla-actions/sccache-action@v0.0.9 - - name: Prepare Environment - run: | - ../.github/workflows/scripts/appimage_prepare_env.sh - - name: Build - run: cargo build --verbose --no-default-features --features=wayland,openxr,openvr,wayvr - - name: Run tests - run: cargo test --verbose --no-default-features --features=wayland,openxr,openvr,wayvr diff --git a/dash-frontend/Cargo.toml b/dash-frontend/Cargo.toml index 2405247..23fb8af 100644 --- a/dash-frontend/Cargo.toml +++ b/dash-frontend/Cargo.toml @@ -24,3 +24,7 @@ hyper = { version = "1.8.1", features = ["client", "http1", "http2"] } http-body-util = "0.1.3" async-native-tls = "0.5.0" smol-hyper = "0.1.1" + +[features] +default = ["monado" ] +monado = [] diff --git a/dash-frontend/src/frontend.rs b/dash-frontend/src/frontend.rs index 3616f21..b89065f 100644 --- a/dash-frontend/src/frontend.rs +++ b/dash-frontend/src/frontend.rs @@ -19,8 +19,8 @@ use wlx_common::{audio, dash_interface::BoxDashInterface, timestep::Timestep}; use crate::{ assets, tab::{ - Tab, TabType, apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses, - settings::TabSettings, + apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, processes::TabProcesses, settings::TabSettings, + Tab, TabType, }, util::{ popup_manager::{MountPopupParams, PopupManager, PopupManagerParams}, @@ -79,6 +79,7 @@ pub struct FrontendUpdateResult { pub struct InitParams { pub interface: BoxDashInterface, + pub has_monado: bool, } #[derive(Clone)] diff --git a/uidev/src/testbed/testbed_dashboard.rs b/uidev/src/testbed/testbed_dashboard.rs index ccd340c..60922e1 100644 --- a/uidev/src/testbed/testbed_dashboard.rs +++ b/uidev/src/testbed/testbed_dashboard.rs @@ -14,6 +14,7 @@ impl TestbedDashboard { let frontend = frontend::Frontend::new( frontend::InitParams { interface: Box::new(interface), + has_monado: true, }, &mut (), )?; diff --git a/wlx-capture/src/frame.rs b/wlx-capture/src/frame.rs index bbdb843..c0c7fc1 100644 --- a/wlx-capture/src/frame.rs +++ b/wlx-capture/src/frame.rs @@ -1,6 +1,6 @@ use std::os::fd::RawFd; -use drm_fourcc::{DrmFormat, DrmModifier}; +use drm_fourcc::{DrmFormat, DrmFourcc, DrmModifier}; #[cfg(feature = "egl")] #[rustfmt::skip] @@ -136,3 +136,12 @@ pub struct MouseMeta { pub x: f32, pub y: f32, } + +pub trait DmaExporter { + fn next_frame( + &mut self, + width: u32, + height: u32, + fourcc: DrmFourcc, + ) -> Option<(FramePlane, DrmModifier)>; +} diff --git a/wlx-capture/src/wlr_screencopy.rs b/wlx-capture/src/wlr_screencopy.rs index 057c36f..4f694a6 100644 --- a/wlx-capture/src/wlr_screencopy.rs +++ b/wlx-capture/src/wlr_screencopy.rs @@ -20,19 +20,10 @@ use smithay_client_toolkit::reexports::protocols_wlr::screencopy::v1::client::zw use crate::{ WlxCapture, - frame::{FrameFormat, FramePlane, MemFdFrame, WlxFrame}, + frame::{DmaExporter, FrameFormat, FramePlane, MemFdFrame, WlxFrame}, wayland::WlxClient, }; -pub trait DmaExporter { - fn next_frame( - &mut self, - width: u32, - height: u32, - fourcc: DrmFourcc, - ) -> Option<(FramePlane, DrmModifier)>; -} - enum BufData { Shm { wl_buffer: WlBuffer, diff --git a/wlx-overlay-s/contrib/wayvr/README.md b/wlx-overlay-s/contrib/wayvr/README.md index ca1a84f..f852726 100644 --- a/wlx-overlay-s/contrib/wayvr/README.md +++ b/wlx-overlay-s/contrib/wayvr/README.md @@ -2,24 +2,6 @@

-**WayVR acts as a bridge between Wayland applications and wlx-overlay-s panels, allowing you to display your applications within a VR environment. Internally, WayVR utilizes Smithay to run a Wayland compositor.** - -# >> Quick setup << - -#### Configure your applications list - -Go to `src/res/wayvr.yaml` to configure your desired application list. This configuration file represents all currently available WayVR options. Feel free to adjust it to your liking. - -#### Add WayVR Launcher to your watch - -Copy `watch_wayvr_example.yaml` to `~/.config/wlxoverlay/watch.yaml`. This file contains pre-configured **WayVRLauncher** and **WayVRDisplayList** widget types. By default, the _default_catalog_ is used. - -That's it; you're all set! - -###### _Make sure you have `wayvr` feature enabled in Cargo.toml (enabled by default)_ - -![alt text](https://raw.githubusercontent.com/galister/wlx-overlay-s/refs/heads/guide/wayvr/watch.jpg) - # Overview ### Features @@ -33,28 +15,6 @@ That's it; you're all set! - Basically all Qt and GTK applications (they work out of the box) - Most XWayland applications via `cage` -### XWayland - -WayVR does not have native XWayland support. You can run X11 applications (or these who require DISPLAY set) by wrapping them in a `cage` program, like so: - -```yaml -- name: "Xeyes" - target_display: "Disp1" - exec: "cage" - args: "xeyes -- -fg blue" -``` - -instead of: - -```yaml -- name: "Xeyes" - target_display: "Disp1" - exec: "xeyes" - args: "-fg blue" -``` - -in `wayvr.yaml` configuration file, in your desired catalog. - ### Launching external apps inside WayVR To launch your app externally: @@ -77,14 +37,6 @@ Setting `DISPLAY` to an empty string forces various apps to use Wayland instead Even though some applications support Wayland, some still check for the `DISPLAY` environment variable and an available X11 server, throwing an error. This can also be fixed by running `cage` on top of them. -### Image corruption - -dma-buf textures may display various graphical glitches due to unsupported dma-buf tiling modifiers between GLES<->Vulkan on Radeon RDNA3 graphics cards. Current situation: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11629). Nvidia should work out of the box, without any isues. Alternatively, you can run wlx-overlay-s with `LIBGL_ALWAYS_SOFTWARE=1` to mitigate that (only the Smithay compositor will run in software renderer mode, wlx will still be accelerated). - ### Floating windows Context menus are not functional in most cases yet, including drag & drop support. - -### Forced window shadows in GTK - -GNOME still insists on rendering client-side decorations instead of server-side ones. This results in all GTK applications looking odd due to additional window shadows. [Fix here, "Client-side decorations"](https://wiki.archlinux.org/title/GTK) diff --git a/wlx-overlay-s/contrib/wayvr/watch_wayvr_example.yaml b/wlx-overlay-s/contrib/wayvr/watch_wayvr_example.yaml deleted file mode 100644 index 4c58117..0000000 --- a/wlx-overlay-s/contrib/wayvr/watch_wayvr_example.yaml +++ /dev/null @@ -1,207 +0,0 @@ -# looking to make changes? -# drop me in ~/.config/wlxoverlay/watch.yaml -# - -width: 0.115 - -size: [400, 272] - -elements: - # background panel - - type: Panel - rect: [0, 30, 400, 130] - corner_radius: 20 - bg_color: "#24273a" - - - type: Button - rect: [2, 162, 26, 36] - corner_radius: 4 - font_size: 15 - bg_color: "#c6a0f6" - fg_color: "#24273a" - text: "C" - click_up: # destroy if exists, otherwise create - - type: Window - target: settings - action: ShowUi # only triggers if not exists - - type: Window - target: settings - action: Destroy # only triggers if exists since before current frame - - # Dashboard toggle button - - type: Button - rect: [32, 162, 48, 36] - corner_radius: 4 - font_size: 15 - bg_color: "#2288FF" - fg_color: "#24273a" - text: "Dash" - click_up: - - type: WayVR - action: ToggleDashboard - - # Keyboard button - - type: Button - rect: [84, 162, 48, 36] - corner_radius: 4 - font_size: 15 - fg_color: "#24273a" - bg_color: "#a6da95" - text: Kbd - click_up: - - type: Overlay - target: "kbd" - action: ToggleVisible - long_click_up: - - type: Overlay - target: "kbd" - action: Reset - right_up: - - type: Overlay - target: "kbd" - action: ToggleImmovable - middle_up: - - type: Overlay - target: "kbd" - action: ToggleInteraction - scroll_up: - - type: Overlay - target: "kbd" - action: - Opacity: { delta: 0.025 } - scroll_down: - - type: Overlay - target: "kbd" - action: - Opacity: { delta: -0.025 } - - # bottom row, of keyboard + overlays - - type: OverlayList - rect: [134, 160, 266, 40] - corner_radius: 4 - font_size: 15 - fg_color: "#cad3f5" - bg_color: "#1e2030" - layout: Horizontal - click_up: ToggleVisible - long_click_up: Reset - right_up: ToggleImmovable - middle_up: ToggleInteraction - scroll_up: - Opacity: { delta: 0.025 } - scroll_down: - Opacity: { delta: -0.025 } - - - type: WayVRLauncher - rect: [0, 200, 400, 36] - corner_radius: 4 - font_size: 15 - fg_color: "#24273a" - bg_color: "#e590c4" - catalog_name: "default_catalog" - - - type: WayVRDisplayList - rect: [0, 236, 400, 36] - corner_radius: 4 - font_size: 15 - fg_color: "#24273a" - bg_color: "#ca68a4" - - # local clock - - type: Label - rect: [19, 90, 200, 50] - corner_radius: 4 - font_size: 46 # Use 32 for 12-hour time - fg_color: "#cad3f5" - source: Clock - format: "%H:%M" # 23:59 - #format: "%I:%M %p" # 11:59 PM - - # local date - - type: Label - rect: [20, 117, 200, 20] - corner_radius: 4 - font_size: 14 - fg_color: "#cad3f5" - source: Clock - format: "%x" # local date representation - - # local day-of-week - - type: Label - rect: [20, 137, 200, 50] - corner_radius: 4 - font_size: 14 - fg_color: "#cad3f5" - source: Clock - format: "%A" # Tuesday - #format: "%a" # Tue - - # alt clock 1 - - type: Label - rect: [210, 90, 200, 50] - corner_radius: 4 - font_size: 24 # Use 18 for 12-hour time - fg_color: "#8bd5ca" - source: Clock - timezone: 0 # change TZ1 here - format: "%H:%M" # 23:59 - #format: "%I:%M %p" # 11:59 PM - - type: Label - rect: [210, 60, 200, 50] - corner_radius: 4 - font_size: 14 - fg_color: "#8bd5ca" - source: Timezone - timezone: 0 # change TZ1 label here - - # alt clock 2 - - type: Label - rect: [210, 150, 200, 50] - corner_radius: 4 - font_size: 24 # Use 18 for 12-hour time - fg_color: "#b7bdf8" - source: Clock - timezone: 1 # change TZ2 here - format: "%H:%M" # 23:59 - #format: "%I:%M %p" # 11:59 PM - - type: Label - rect: [210, 120, 200, 50] - corner_radius: 4 - font_size: 14 - fg_color: "#b7bdf8" - source: Timezone - timezone: 1 # change TZ2 label here - - # batteries - - type: BatteryList - rect: [0, 5, 400, 30] - corner_radius: 4 - font_size: 16 - fg_color: "#8bd5ca" - fg_color_low: "#B06060" - fg_color_charging: "#6080A0" - num_devices: 9 - layout: Horizontal - low_threshold: 33 - - # volume buttons - - type: Button - rect: [315, 52, 70, 32] - corner_radius: 4 - font_size: 13 - fg_color: "#cad3f5" - bg_color: "#5b6078" - text: "Vol +" - click_down: - - type: Exec - command: ["pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%"] - - type: Button - rect: [315, 116, 70, 32] - corner_radius: 4 - font_size: 13 - fg_color: "#cad3f5" - bg_color: "#5b6078" - text: "Vol -" - click_down: - - type: Exec - command: ["pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%"] diff --git a/wlx-overlay-s/src/config.rs b/wlx-overlay-s/src/config.rs index c2c6030..0df923a 100644 --- a/wlx-overlay-s/src/config.rs +++ b/wlx-overlay-s/src/config.rs @@ -12,12 +12,9 @@ use wlx_common::{ overlays::BackendAttribValue, }; -const FALLBACKS: [&str; 2] = [ - include_str!("res/keyboard.yaml"), - include_str!("res/wayvr.yaml"), -]; +const FALLBACKS: [&str; 1] = [include_str!("res/keyboard.yaml")]; -const FILES: [&str; 2] = ["keyboard.yaml", "wayvr.yaml"]; +const FILES: [&str; 1] = ["keyboard.yaml"]; #[derive(Clone, Copy)] #[repr(usize)] @@ -26,8 +23,6 @@ pub enum ConfigType { Watch, Settings, Anchor, - #[allow(dead_code)] - WayVR, } pub fn load_known_yaml(config_type: ConfigType) -> T diff --git a/wlx-overlay-s/src/overlays/dashboard.rs b/wlx-overlay-s/src/overlays/dashboard.rs index 8033643..cefc5f0 100644 --- a/wlx-overlay-s/src/overlays/dashboard.rs +++ b/wlx-overlay-s/src/overlays/dashboard.rs @@ -27,6 +27,7 @@ use wlx_common::{ use crate::{ RESTART, RUNNING, backend::{ + XrBackend, input::{Haptics, HoverResult, PointerHit, PointerMode}, task::{OverlayTask, PlayspaceTask, TaskType, ToggleMode}, wayvr::{ @@ -75,6 +76,7 @@ impl DashFrontend { let frontend = frontend::Frontend::new( frontend::InitParams { interface: Box::new(interface), + has_monado: matches!(app.xr_backend, XrBackend::OpenXR), }, app, )?; @@ -445,6 +447,7 @@ impl DashInterface for DashInterfaceLive { RESTART.store(true, Ordering::Relaxed); } + #[cfg(feature = "openxr")] fn monado_client_list( &mut self, app: &mut AppState, @@ -475,6 +478,7 @@ impl DashInterface for DashInterfaceLive { Ok(res) } + #[cfg(feature = "openxr")] fn monado_client_focus(&mut self, app: &mut AppState, name: &str) -> anyhow::Result<()> { let Some(monado) = &mut app.monado else { return Ok(()); // no monado avoilable @@ -488,6 +492,7 @@ impl DashInterface for DashInterfaceLive { Ok(()) } + #[cfg(feature = "openxr")] fn monado_brightness_get(&mut self, app: &mut AppState) -> Option { let Some(monado) = &mut app.monado else { return None; @@ -496,6 +501,7 @@ impl DashInterface for DashInterfaceLive { monado_get_brightness(monado) } + #[cfg(feature = "openxr")] fn monado_brightness_set(&mut self, app: &mut AppState, brightness: f32) -> Option<()> { let Some(monado) = &mut app.monado else { return None; @@ -503,21 +509,44 @@ impl DashInterface for DashInterfaceLive { monado_set_brightness(monado, brightness).ok() } + + #[cfg(not(feature = "openxr"))] + fn monado_client_list( + &mut self, + _: &mut AppState, + ) -> anyhow::Result> { + anyhow::bail!("Not supported in this build.") + } + #[cfg(not(feature = "openxr"))] + fn monado_client_focus(&mut self, _: &mut AppState, _: &str) -> anyhow::Result<()> { + anyhow::bail!("Not supported in this build.") + } + #[cfg(not(feature = "openxr"))] + fn monado_brightness_get(&mut self, _: &mut AppState) -> Option { + None + } + #[cfg(not(feature = "openxr"))] + fn monado_brightness_set(&mut self, _: &mut AppState, _: f32) -> Option<()> { + None + } } const CLIENT_NAME_BLACKLIST: [&str; 2] = ["wlx-overlay-s", "libmonado"]; +#[cfg(feature = "openxr")] fn monado_get_brightness(monado: &mut libmonado::Monado) -> Option { let device = monado.device_from_role(libmonado::DeviceRole::Head).ok()?; device.brightness().ok() } +#[cfg(feature = "openxr")] fn monado_set_brightness(monado: &mut libmonado::Monado, brightness: f32) -> anyhow::Result<()> { let device = monado.device_from_role(libmonado::DeviceRole::Head)?; device.set_brightness(brightness, false)?; Ok(()) } +#[cfg(feature = "openxr")] fn monado_list_clients_filtered( monado: &mut libmonado::Monado, ) -> anyhow::Result>> { @@ -544,6 +573,7 @@ fn monado_list_clients_filtered( Ok(clients) } +#[cfg(feature = "openxr")] fn monado_client_focus(monado: &mut libmonado::Monado, name: &str) -> anyhow::Result<()> { let clients = monado_list_clients_filtered(monado)?; diff --git a/wlx-overlay-s/src/overlays/screen/capture.rs b/wlx-overlay-s/src/overlays/screen/capture.rs index 4e35d4f..b52c13d 100644 --- a/wlx-overlay-s/src/overlays/screen/capture.rs +++ b/wlx-overlay-s/src/overlays/screen/capture.rs @@ -27,8 +27,7 @@ use wgui::{ }; use wlx_capture::{ DrmFormat, DrmFourcc, DrmModifier, WlxCapture, - frame::{self as wlx_frame, FrameFormat, MouseMeta, WlxFrame}, - wlr_screencopy::DmaExporter, + frame::{self as wlx_frame, DmaExporter, FrameFormat, MouseMeta, WlxFrame}, }; use wlx_common::{config::GeneralConfig, overlays::StereoMode}; diff --git a/wlx-overlay-s/src/res/wayvr.yaml b/wlx-overlay-s/src/res/wayvr.yaml deleted file mode 100644 index 0f7767b..0000000 --- a/wlx-overlay-s/src/res/wayvr.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# This is an example WayVR panel configuration. It demonstrates all the capabilities of this module. -# looking to make changes? -# drop me in ~/.config/wlxoverlay/wayvr.yaml -# - -version: 1 - -# If your gpu has some issues with zero-copy textures, you can set this option to "software". -# -# Possible options: -# "dmabuf": Use zero-copy texture access (from EGL to Vulkan) - no performance impact -# "software": Read pixel data to memory via glReadPixels() every time a content has been updated. Minor performance impact on large resolutions -blit_method: "dmabuf" - -# Automatically close overlays with zero window count? -auto_hide: true - -# For how long an overlay should be visible in case if there are no windows present? (in milliseconds, auto_hide needs to be enabled) -# This value shouldn't be set at 0, because some programs could re-initialize a window during startup (splash screens for example) -auto_hide_delay: 750 - -# In milliseconds -keyboard_repeat_delay: 200 - -# Chars per second -keyboard_repeat_rate: 50 - -# WayVR-compatible dashboard. -# For now, there is only one kind of dashboard with WayVR IPC support (WayVR Dashboard). -# -# Build instructions: https://github.com/olekolek1000/wayvr-dashboard -# -# exec: Executable path, for example "/home/USER/wayvr-dashboard/src-tauri/target/release/wayvr-dashboard" -# or just "wayvr-dashboard" if you have it installed from your package manager. -dashboard: - exec: "wayvr-dashboard" - args: "" - env: [] - -displays: - watch: - width: 400 - height: 600 - scale: 0.4 - attach_to: "HandRight" # HandLeft, HandRight - pos: [0.0, 0.0, 0.125] - rotation: {axis: [1.0, 0.0, 0.0], angle: -45.0} - disp1: - width: 640 - height: 480 - primary: true # Required if you want to attach external processes (not spawned by WayVR itself) without WAYVR_DISPLAY_NAME set - disp2: - width: 1280 - height: 720 - scale: 2.0 - -catalogs: - default_catalog: - apps: - - name: "Calc" - target_display: "disp1" - exec: "kcalc" - env: ["FOO=bar"] - shown_at_start: false - - - name: "htop" - target_display: "watch" - exec: "konsole" - args: "-e htop" - - - name: "Browser" - target_display: "disp2" - exec: "cage" - args: "chromium -- --incognito" -