Update Monado IPC, display brightness slider

This commit is contained in:
Aleksander
2026-01-08 20:54:43 +01:00
parent e421c39539
commit b260c6c625
12 changed files with 225 additions and 154 deletions

View File

@@ -57,7 +57,7 @@ interprocess = { version = "2.2.3" }
json = { version = "0.12.4", optional = true }
json5 = "1.3.0"
libc = "0.2.178"
libmonado = { version = "1.3.2", optional = true }
libmonado = { git = "https://github.com/technobaboo/libmonado-rs.git", rev = "26292e5b14663ee2f089f66f0851438a0c00ee67", optional = true }
log-panics = { version = "2.1.0", features = ["with-backtrace"] }
mint = "0.5.9"
openxr = { git = "https://github.com/Ralith/openxrs", rev = "d0afdd3365bc1e14de28f6a3a21f457e788a702e", features = [

View File

@@ -487,10 +487,37 @@ impl DashInterface<AppState> for DashInterfaceLive {
app.monado_init();
Ok(())
}
fn monado_brightness_get(&mut self, app: &mut AppState) -> Option<f32> {
let Some(monado) = &mut app.monado else {
return None;
};
monado_get_brightness(monado)
}
fn monado_brightness_set(&mut self, app: &mut AppState, brightness: f32) -> Option<()> {
let Some(monado) = &mut app.monado else {
return None;
};
monado_set_brightness(monado, brightness).ok()
}
}
const CLIENT_NAME_BLACKLIST: [&str; 2] = ["wlx-overlay-s", "libmonado"];
fn monado_get_brightness(monado: &mut libmonado::Monado) -> Option<f32> {
let device = monado.device_from_role(libmonado::DeviceRole::Head).ok()?;
device.brightness().ok()
}
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(())
}
fn monado_list_clients_filtered(
monado: &mut libmonado::Monado,
) -> anyhow::Result<Vec<libmonado::Client<'_>>> {