Read the portal's colour scheme as the D-Bus variant it is

ReadOne replies with a variant body (signature v); deserializing it
straight to u32 (signature u) is a signature mismatch that zvariant
rejects, so the initial colour scheme never arrived and system mode
kept its light fallback. Take the Value and read the uint32 out of it.
This commit is contained in:
ahmedhosnypro
2026-10-16 10:58:06 +03:00
parent 4c494b804f
commit d55781e56e
+7 -3
View File
@@ -174,9 +174,13 @@ fn watch_system_dark(dark: Arc<AtomicU8>) {
return;
};
let read = || -> zbus::Result<u32> {
conn.call_method(Some(PORTAL), "/org/freedesktop/portal/desktop", Some(SETTINGS), "ReadOne", &(APPEARANCE, "color-scheme"))?
.body()
.deserialize()
let reply = conn.call_method(Some(PORTAL), "/org/freedesktop/portal/desktop", Some(SETTINGS), "ReadOne", &(APPEARANCE, "color-scheme"))?;
let body = reply.body();
let value = body.deserialize::<zbus::zvariant::Value>()?;
match value {
zbus::zvariant::Value::U32(v) => Ok(v),
_ => Ok(0),
}
};
match read() {
Ok(v) => store(v),