Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dark theme switch apply to color scheme pref #444

Merged
merged 1 commit into from
Sep 5, 2023
Merged
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
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);
}
}
}