Skip to content

Commit

Permalink
WayVR: Modify readme, Various improvements
Browse files Browse the repository at this point in the history
- Add "Quick setup" and images in readme
- Implement `click_freeze_time_ms`
- Automatically show hidden display if AppClick has been triggered
  • Loading branch information
olekolek1000 committed Nov 3, 2024
1 parent 24096b7 commit 96db24d
Show file tree
Hide file tree
Showing 14 changed files with 485 additions and 157 deletions.
90 changes: 90 additions & 0 deletions contrib/wayvr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<p align="center">
<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

- Display Wayland applications without GPU overhead (zero-copy via dma-buf)
- Mouse and keyboard input, with precision scrolling support
- Tested on AMD and Nvidia

### Supported software

- Basically all Qt 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:

```sh
DISPLAY= WAYLAND_DISPLAY=wayland-$(cat $XDG_RUNTIME_DIR/wayvr.disp) yourapp
```

or (in the most cases):

```
DISPLAY= WAYLAND_DISPLAY=wayland-20 yourapp
```

Setting `DISPLAY` to an empty string forces various apps to use Wayland instead of X11.

# Troubleshooting

### My application doesn't launch but others do!

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)
195 changes: 195 additions & 0 deletions contrib/wayvr/watch_wayvr_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# 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

# Keyboard button
- type: Button
rect: [32, 162, 60, 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: [94, 160, 306, 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: "Asia/Tokyo" # 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: Static
text: "Tokyo" # 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: "America/Chicago" # 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: Static
text: "Chicago" # 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%"]
2 changes: 1 addition & 1 deletion src/backend/openvr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ pub fn openvr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),

#[cfg(feature = "wayvr")]
if let Some(wayvr) = &state.wayvr {
wayvr.borrow_mut().tick_finish()?;
wayvr.borrow_mut().state.tick_finish()?;
}

// chaperone
Expand Down
2 changes: 1 addition & 1 deletion src/backend/openxr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),

#[cfg(feature = "wayvr")]
if let Some(wayvr) = &app_state.wayvr {
wayvr.borrow_mut().tick_finish()?;
wayvr.borrow_mut().state.tick_finish()?;
}

command_buffer.build_and_execute_now()?;
Expand Down
37 changes: 0 additions & 37 deletions src/backend/wayvr/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/backend/wayvr/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn export_display_number(display_num: u32) -> anyhow::Result<()> {
.map(PathBuf::from)
.unwrap_or_else(|_| PathBuf::from("/tmp"));
path.push("wayvr.disp");
std::fs::write(path, format!("{}\n", display_num)).unwrap();
std::fs::write(path, format!("{}\n", display_num))?;
Ok(())
}

Expand Down
Loading

0 comments on commit 96db24d

Please sign in to comment.