Skip to content

Commit cab3a19

Browse files
committed
Set icon theme and button layout for GNOME only if requested
This ensures that the icon theme and button layout for GNOME applications are not overwritten at login and when changed in the settings if the 'apply_theme_global' setting is disabled. This allows users to decide whether they want COSMIC to modify GNOME settings.
1 parent fbd4ade commit cab3a19

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/theme.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ pub async fn watch_theme(
156156
}
157157
};
158158

159-
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
160-
set_gnome_icon_theme(tk.icon_theme.clone());
161-
162159
let light_helper = CosmicTheme::light_config()?;
163160
let dark_helper = CosmicTheme::dark_config()?;
164161

165162
if tk.apply_theme_global {
163+
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
164+
set_gnome_icon_theme(tk.icon_theme.clone());
165+
166166
// Write the gtk variables for both themes in case they have changed in the meantime
167167
let dark = match Theme::get_entry(&dark_helper) {
168168
Ok(t) => t,
@@ -295,19 +295,24 @@ pub async fn watch_theme(
295295
log::error!("Error updating the theme toolkit config {err:?}");
296296
}
297297

298-
if changes.contains(&"icon_theme") {
299-
set_gnome_icon_theme(tk.icon_theme.clone());
300-
}
298+
if tk.apply_theme_global {
299+
if changes.contains(&"icon_theme") {
300+
set_gnome_icon_theme(tk.icon_theme.clone());
301+
}
301302

302-
if changes.contains(&"show_maximize") || changes.contains(&"show_minimize") {
303-
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
303+
if changes.contains(&"show_maximize") || changes.contains(&"show_minimize") {
304+
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
305+
}
304306
}
305307

306308
if !changes.contains(&"apply_theme_global") {
307309
continue;
308310
}
309311

310312
if tk.apply_theme_global {
313+
set_gnome_icon_theme(tk.icon_theme.clone());
314+
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
315+
311316
// Write the gtk variables for both themes in case they have changed in the meantime
312317
let dark = match Theme::get_entry(&dark_helper) {
313318
Ok(t) => t,

0 commit comments

Comments
 (0)