Skip to content

Commit

Permalink
Make dark theme switch apply to color scheme pref (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
serebit authored Sep 5, 2023
1 parent 721914f commit f3e4d21
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/daemon/settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ namespace Budgie {
LEFT = 1 << 0,
TRADITIONAL = 1 << 1,
}

private enum ColorScheme {
DEFAULT,
PREFER_DARK,
PREFER_LIGHT
}

/**
* The SettingsManager currently only has a very simple job, and looks for
* session wide settings changes to respond to
Expand All @@ -43,6 +50,7 @@ namespace Budgie {
private Settings? gnome_session_settings = null;
private Settings? gnome_sound_settings = null;
private Settings? gnome_wm_settings = null;
private Settings? panel_settings = null;
private Settings? raven_settings = null;
private Settings? wm_settings = null;
private Settings? xoverrides = null;
Expand Down Expand Up @@ -74,6 +82,7 @@ namespace Budgie {
gnome_session_settings = new Settings("org.gnome.desktop.session");
gnome_sound_settings = new Settings("org.gnome.desktop.sound");
gnome_wm_settings = new Settings("org.gnome.desktop.wm.preferences");
panel_settings = new Settings("com.solus-project.budgie-panel");
raven_settings = new Settings("com.solus-project.budgie-raven");
xoverrides = new Settings("org.gnome.settings-daemon.plugins.xsettings");
wm_settings = new Settings("com.solus-project.budgie-wm");
Expand All @@ -89,6 +98,10 @@ namespace Budgie {
enforce_mutter_settings(); // Call enforce mutter settings so we ensure we transition our Mutter settings over to BudgieWM
raven_settings.changed["allow-volume-overdrive"].connect(this.on_raven_sound_overdrive_change);


panel_settings.changed["dark-theme"].connect((key) => apply_dark_theme_pref());
apply_dark_theme_pref();

gnome_session_settings.changed["idle-delay"].connect(this.update_idle_delay);
gnome_power_settings.changed["idle-dim"].connect(this.update_idle_dim);
gnome_power_settings.changed["sleep-inactive-ac-timeout"].connect(this.update_ac_timeout);
Expand Down Expand Up @@ -441,5 +454,10 @@ namespace Budgie {
default_idle_dim = gnome_power_settings.get_boolean("idle-dim");
}
}

private void apply_dark_theme_pref() {
var scheme = panel_settings.get_boolean("dark-theme") ? ColorScheme.PREFER_DARK : ColorScheme.PREFER_LIGHT;
gnome_desktop_settings.set_enum("color-scheme", scheme);
}
}
}

0 comments on commit f3e4d21

Please sign in to comment.