Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ pub async fn watch_theme(
}
};

set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
set_gnome_icon_theme(tk.icon_theme.clone());

let light_helper = CosmicTheme::light_config()?;
let dark_helper = CosmicTheme::dark_config()?;

if tk.apply_theme_global {
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
set_gnome_icon_theme(tk.icon_theme.clone());

// Write the gtk variables for both themes in case they have changed in the meantime
let dark = match Theme::get_entry(&dark_helper) {
Ok(t) => t,
Expand Down Expand Up @@ -295,19 +295,24 @@ pub async fn watch_theme(
log::error!("Error updating the theme toolkit config {err:?}");
}

if changes.contains(&"icon_theme") {
set_gnome_icon_theme(tk.icon_theme.clone());
}
if tk.apply_theme_global {
if changes.contains(&"icon_theme") {
set_gnome_icon_theme(tk.icon_theme.clone());
}

if changes.contains(&"show_maximize") || changes.contains(&"show_minimize") {
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
if changes.contains(&"show_maximize") || changes.contains(&"show_minimize") {
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);
}
}

if !changes.contains(&"apply_theme_global") {
continue;
}

if tk.apply_theme_global {
set_gnome_icon_theme(tk.icon_theme.clone());
set_gnome_button_layout(tk.show_maximize, tk.show_minimize);

// Write the gtk variables for both themes in case they have changed in the meantime
let dark = match Theme::get_entry(&dark_helper) {
Ok(t) => t,
Expand Down