fix features

This commit is contained in:
galister
2026-01-09 20:27:20 +09:00
parent eb69ec8fe3
commit c799ecea93
12 changed files with 52 additions and 380 deletions

View File

@@ -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

View File

@@ -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 = []

View File

@@ -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<T> {
pub interface: BoxDashInterface<T>,
pub has_monado: bool,
}
#[derive(Clone)]

View File

@@ -14,6 +14,7 @@ impl TestbedDashboard {
let frontend = frontend::Frontend::new(
frontend::InitParams {
interface: Box::new(interface),
has_monado: true,
},
&mut (),
)?;

View File

@@ -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)>;
}

View File

@@ -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,

View File

@@ -2,24 +2,6 @@
<img src="https://raw.githubusercontent.com/galister/wlx-overlay-s/refs/heads/guide/wayvr/logo.svg" height="120"/>
</p>
**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)

View File

@@ -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%"]

View File

@@ -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<T>(config_type: ConfigType) -> T

View File

@@ -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<AppState> 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<AppState> 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<AppState> for DashInterfaceLive {
Ok(())
}
#[cfg(feature = "openxr")]
fn monado_brightness_get(&mut self, app: &mut AppState) -> Option<f32> {
let Some(monado) = &mut app.monado else {
return None;
@@ -496,6 +501,7 @@ impl DashInterface<AppState> 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<AppState> for DashInterfaceLive {
monado_set_brightness(monado, brightness).ok()
}
#[cfg(not(feature = "openxr"))]
fn monado_client_list(
&mut self,
_: &mut AppState,
) -> anyhow::Result<Vec<dash_interface::MonadoClient>> {
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<f32> {
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<f32> {
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<Vec<libmonado::Client<'_>>> {
@@ -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)?;

View File

@@ -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};

View File

@@ -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"