fix: apply the system theme change when updating the mode
This commit is contained in:
parent
18b22905e2
commit
047a8376ee
1 changed files with 3 additions and 1 deletions
|
|
@ -334,12 +334,14 @@ impl<T: Application> Cosmic<T> {
|
||||||
let changed = core.system_theme_mode.is_dark != mode.is_dark;
|
let changed = core.system_theme_mode.is_dark != mode.is_dark;
|
||||||
core.system_theme_mode = mode;
|
core.system_theme_mode = mode;
|
||||||
if changed {
|
if changed {
|
||||||
|
let new_theme = crate::theme::system_preference();
|
||||||
|
core.system_theme = new_theme.clone();
|
||||||
THEME.with(move |t| {
|
THEME.with(move |t| {
|
||||||
let mut cosmic_theme = t.borrow_mut();
|
let mut cosmic_theme = t.borrow_mut();
|
||||||
|
|
||||||
// Only apply update if the theme is set to load a system theme
|
// Only apply update if the theme is set to load a system theme
|
||||||
if let ThemeType::System(_) = cosmic_theme.theme_type {
|
if let ThemeType::System(_) = cosmic_theme.theme_type {
|
||||||
cosmic_theme.set_theme(crate::theme::system_preference().theme_type);
|
cosmic_theme.set_theme(new_theme.theme_type);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue