Skip to content

Commit 5e27e70

Browse files
committed
Fixes for theme updates
1 parent 68522ff commit 5e27e70

File tree

4 files changed

+18
-100
lines changed

4 files changed

+18
-100
lines changed

Cargo.lock

Lines changed: 3 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cosmic-settings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ git = "https://github.com/AerynOS/locales-rs"
117117
optional = true
118118

119119
[features]
120-
default = ["a11y", "dbus-config", "linux", "single-instance", "wgpu"]
120+
default = ["a11y", "linux", "single-instance", "wgpu"]
121121
gettext = ["dep:gettext-rs"]
122122

123123
# Default features for Linux

cosmic-settings/src/app.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ impl cosmic::Application for SettingsApp {
230230
}
231231
.unwrap_or(desktop_id);
232232

233-
let task = app.activate_page(active_id);
233+
let task = Task::batch([
234+
cosmic::command::set_theme(cosmic::theme::system_preference()),
235+
app.activate_page(active_id),
236+
]);
234237
(app, task)
235238
}
236239

cosmic-settings/src/pages/desktop/appearance/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ impl Page {
619619
tracing::error!(?err, "Error setting dark mode");
620620
}
621621

622-
self.reload_theme_mode();
622+
tasks.push(self.reload_theme_mode());
623623
}
624624
}
625625

@@ -894,6 +894,10 @@ impl Page {
894894
.iter()
895895
.position(|theme| theme.id == active_icon_theme);
896896
self.icon_handles = icon_handles;
897+
898+
tasks.push(cosmic::task::message(app::Message::SetTheme(
899+
cosmic::theme::system_preference(),
900+
)));
897901
}
898902

899903
Message::Left => {
@@ -976,7 +980,7 @@ impl Page {
976980
Self::update_panel_spacing(Density::Standard);
977981
});
978982

979-
self.reload_theme_mode();
983+
tasks.push(self.reload_theme_mode());
980984
}
981985

982986
#[cfg(feature = "xdg-portal")]
@@ -1111,7 +1115,7 @@ impl Page {
11111115
tracing::error!("Failed to get the theme config.");
11121116
}
11131117

1114-
self.reload_theme_mode();
1118+
tasks.push(self.reload_theme_mode());
11151119
}
11161120

11171121
Message::UseDefaultWindowHint(v) => {
@@ -1293,7 +1297,7 @@ impl Page {
12931297
];
12941298
}
12951299

1296-
fn reload_theme_mode(&mut self) {
1300+
fn reload_theme_mode(&mut self) -> Task<app::Message> {
12971301
let entity = self.entity;
12981302
let font_config = std::mem::take(&mut self.font_config);
12991303
let icon_themes = std::mem::take(&mut self.icon_themes);
@@ -1316,6 +1320,8 @@ impl Page {
13161320
self.icon_handles = icon_handles;
13171321
self.icon_theme_active = icon_theme_active;
13181322
self.font_config = font_config;
1323+
1324+
cosmic::task::message(app::Message::SetTheme(cosmic::theme::system_preference()))
13191325
}
13201326

13211327
fn update_color_picker(

0 commit comments

Comments
 (0)