Skip to content

Commit

Permalink
Emit onThemChanged on the them-variant changes
Browse files Browse the repository at this point in the history
If SETTINGS_PROFILE_USE_THEME_COLORS_KEY was set the terminal
background/foreground colors were not updated automatically on
theme-variant change.

This modifies the behaviour so that:
 - "String theme" parameter is removed since it was unused
 - onThemChanged() is emitted for theme and theme-variant changes

With this the terminal colors are updated if the theme or
theme-variant is modified.
  • Loading branch information
flaktack authored and ximion committed Nov 6, 2023
1 parent 3db741a commit 8ff83f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions source/gx/tilix/application.d
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ private:
if (!themeCssProvider) {
tracef("No specific CSS found %s", cssURI);
}
onThemeChange.emit(theme);
onThemeChange.emit();
}

void onAppStartup(GApplication) {
Expand Down Expand Up @@ -587,6 +587,7 @@ private:
} else {
Settings.getDefault().setProperty(GTK_APP_PREFER_DARK_THEME, darkMode);
}
onThemeChange.emit();
clearBookmarkIconCache();
break;
case SETTINGS_MENU_ACCELERATOR_KEY:
Expand Down Expand Up @@ -917,13 +918,11 @@ public:
// Events
public:
/**
* Invoked when the GTK theme has changed. While things could
* listen to gtk.Settings.addOnNotify directly, because this is a
* long lived object and GtkD doesn't provide a way to remove
* listeners it will lead to memory leaks so we use this instead
*
* Params:
* name = the name of the theme
* Invoked when the GTK theme or theme-variant has changed. While
* things could listen to gtk.Settings.addOnNotify directly,
* because this is a long lived object and GtkD doesn't provide a
* way to remove listeners it will lead to memory leaks so we use
* this instead
*/
GenericEvent!(string) onThemeChange;
GenericEvent!() onThemeChange;
}
2 changes: 1 addition & 1 deletion source/gx/tilix/terminal/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -3698,7 +3698,7 @@ private:

// Theme changed
private:
void onThemeChanged(string theme) {
void onThemeChanged() {
//Get CSS Provider updated via preference
applyPreference(SETTINGS_PROFILE_BG_COLOR_KEY);
}
Expand Down

0 comments on commit 8ff83f2

Please sign in to comment.