diff --git a/data/styles/Application.css b/data/styles/Application.css index b0e407f2..a6e7cd7b 100644 --- a/data/styles/Application.css +++ b/data/styles/Application.css @@ -24,7 +24,7 @@ panel.translucent.color-dark > box { } panel.translucent.color-light > box { - background-color: alpha(white, 0.3); + background-color: alpha(white, 0.5); box-shadow: inset 0 -1px 0 0 alpha(white, 0.15), inset 0 1px 0 0 alpha(white, 0.15), diff --git a/src/Services/BackgroundManager.vala b/src/Services/BackgroundManager.vala index 110f1449..49a9c504 100644 --- a/src/Services/BackgroundManager.vala +++ b/src/Services/BackgroundManager.vala @@ -44,6 +44,7 @@ namespace Wingpanel.Services { private InterfaceBus? bus = null; + // Latest state as sent from Gala private BackgroundState current_state = BackgroundState.LIGHT; private bool use_transparency = true; @@ -66,6 +67,8 @@ namespace Wingpanel.Services { private BackgroundManager () { var panel_settings = new GLib.Settings ("io.elementary.desktop.wingpanel"); + Gtk.Settings.get_default ().notify["gtk-application-prefer-dark-theme"].connect (() => state_updated ()); + panel_settings.changed["use-transparency"].connect (() => { use_transparency = panel_settings.get_boolean ("use-transparency"); state_updated (); @@ -137,8 +140,27 @@ namespace Wingpanel.Services { state_updated (); } - private void state_updated (uint animation_duration = 0) { - background_state_changed (use_transparency ? current_state : BackgroundState.MAXIMIZED, animation_duration); + private void state_updated (uint animation_duration = Granite.TRANSITION_DURATION_IN_PLACE) { + if (!use_transparency) { + background_state_changed (BackgroundState.MAXIMIZED, animation_duration); + return; + } + + switch (current_state) { + case TRANSLUCENT_DARK: + case TRANSLUCENT_LIGHT: + // Prefer user preference: https://github.com/elementary/wingpanel/issues/657 + if (Gtk.Settings.get_default ().gtk_application_prefer_dark_theme) { + background_state_changed (TRANSLUCENT_LIGHT, animation_duration); + } else { + background_state_changed (TRANSLUCENT_DARK, animation_duration); + } + return; + default: + break; + } + + background_state_changed (current_state, animation_duration); } public static BackgroundManager get_default () {