Closed fenhl closed 1 year ago
Here's code that works when used in an iced
app launched from the Files app:
use gio::traits::SettingsExt;
enum Theme {
Light,
Dark,
}
fn theme() -> Option<Theme> {
let settings = gio::Settings::new("org.gnome.desktop.interface");
if settings.settings_schema().map_or(false, |schema| schema.has_key("color-scheme")) {
match settings.string("color-scheme").as_str() {
"prefer-light" => Some(Theme::Light),
"prefer-dark" => Some(Theme::Dark),
_ => None,
}
} else {
None
}
}
The
dark-light
crate which we're using to detect the system theme currently does not work properly on Ubuntu. There is agsettings
command which in some situations reports the theme correctly but errors in others. Need to investigate whether it works correctly in normal use of the multiworld installer and app. It's also possible that thegio
crate could be used instead of subprocesses.