-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression from v1.0.0
#39
Comments
I experience this as well, dark-light version 1.1.1 returns an incorrect theme for detect |
Can you narrow down if it was from 1.1.0 to 1.1.1 or 1.0.0 to 1.1.0. It could be the zbus bump which caused this. |
It was |
Yes, it is zbus bump because zbus 0.4 introduced `body.deserialize::(). The current 1.1.0 code uses: let theme = reply.body().deserialize::<u32>(); But the body of the message is structured like this: let body = reply.body();
let theme: zbus::zvariant::Structure = body.deserialize().unwrap();
println!("theme: {:?}", theme); (I use OpenSUSE Leap 15.6, KDE Plasma 5.27.11, BreezeDark, xdg-desktop-portal 1.18.2, X11) |
Therefore i would recommend to use After that is is required to downcast the Value(U32) to U32. fn get_freedesktop_color_scheme() -> Option<Mode> {
let conn = Connection::session();
if conn.is_err() {
return None;
}
let reply = conn.unwrap().call_method(
Some("org.freedesktop.portal.Desktop"),
"/org/freedesktop/portal/desktop",
Some("org.freedesktop.portal.Settings"),
"ReadOne",
&("org.freedesktop.appearance", "color-scheme"),
);
if let Ok(reply) = &reply {
let body = reply.body();
let value = body.deserialize::<Value>();
if value.is_err() {
return None;
}
let theme = value.unwrap().downcast::<u32>();
if theme.is_err() {
return None;
}
match theme.unwrap() {
1 => Some(Mode::Dark),
2 => Some(Mode::Light),
_ => None,
}
} else {
None
}
} |
You could also keep let body = reply.body();
let val_val = body.deserialize::<Value>();
if val_val.is_err() {
return None;
}
let val = val_val.unwrap().downcast::<Value>();
if val.is_err() {
return None;
}
let theme = val.unwrap().downcast::<u32>();
if theme.is_err() {
return None;
} Obviously are thos err checks not needed it that amount and can be simplified but it showns the changes in zbus |
Oh, i saw its fixed on main by using ashpd. |
Universal-Debloater-Alliance/universal-android-debloater-next-generation#627
src/main.rs
:Cargo.toml
:The 2 variations of
dependencies
fromCargo.toml
where tested on separate directories, for better isolation (no need forcargo update
) and to avoid recompilation of recursive deps (although I tried to recycletarget/
)The text was updated successfully, but these errors were encountered: