feat(switcheroo): Discrete parameter support with fallback to !default

This commit is contained in:
Jan 2026-02-13 01:18:07 +01:00 committed by GitHub
parent 87c3c35666
commit 755442641e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,11 +103,16 @@ impl TryFrom<HashMap<String, OwnedValue>> for Gpu {
.get("Default")
.ok_or(zvariant::Error::IncorrectType)?
.try_into()?;
let discrete = value
.get("Discrete")
.and_then(|v| v.try_into().ok())
.unwrap_or(!default);
Ok(Self {
name,
environment,
default,
discrete,
})
}
}
@ -125,4 +130,5 @@ pub struct Gpu {
pub name: String,
pub environment: HashMap<String, String>,
pub default: bool,
pub discrete: bool,
}