Skip to content

Commit dd62577

Browse files
hoshinolinaslp
authored andcommitted
x11: Use x112virtgpu for the secondary X11 forward if it is installed
This lets us easily test this alternative to sommelier+XWayland without committing to making it the default. Signed-off-by: Asahi Lina <[email protected]>
1 parent 4a7c43b commit dd62577

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

crates/muvm/src/guest/x11.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ use std::env;
22
use std::fs::File;
33
use std::io::{Read, Write};
44
use std::path::Path;
5+
use std::process::Command;
56

67
use anyhow::{anyhow, Context, Result};
78
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
89

910
use super::socket::setup_socket_proxy;
1011

12+
use crate::utils::env::find_in_path;
13+
1114
pub fn setup_x11_forwarding<P>(run_path: P) -> Result<()>
1215
where
1316
P: AsRef<Path>,
@@ -23,7 +26,17 @@ where
2326
}
2427
let host_display = &host_display[1..];
2528

26-
setup_socket_proxy(Path::new("/tmp/.X11-unix/X1"), 6000)?;
29+
let x112virtgpu_path =
30+
find_in_path("x112virtgpu").context("Failed to check existence of `x112virtgpu`")?;
31+
32+
if x112virtgpu_path.is_some() {
33+
let mut cmd = Command::new(x112virtgpu_path.unwrap());
34+
cmd.args(["--listen-display", ":1"]);
35+
36+
cmd.spawn().context("Failed to spawn `x112virtgpu`")?;
37+
} else {
38+
setup_socket_proxy(Path::new("/tmp/.X11-unix/X1"), 6000)?;
39+
}
2740

2841
// Set HOST_DISPLAY to :1, which is the display number within the guest
2942
// at which the actual host display is accessible.

0 commit comments

Comments
 (0)