mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-30 21:36:46 -06:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user