Skip to content

Commit

Permalink
fix: apply the system theme change when updating the mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Oct 26, 2023
1 parent 18b2290 commit 047a837
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/cosmic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,14 @@ impl<T: Application> Cosmic<T> {
let changed = core.system_theme_mode.is_dark != mode.is_dark;
core.system_theme_mode = mode;
if changed {
let new_theme = crate::theme::system_preference();
core.system_theme = new_theme.clone();
THEME.with(move |t| {
let mut cosmic_theme = t.borrow_mut();

// Only apply update if the theme is set to load a system theme
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);
}
});
}
Expand Down

0 comments on commit 047a837

Please sign in to comment.