Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion data/styles/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
26 changes: 24 additions & 2 deletions src/Services/BackgroundManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 ();
Expand Down Expand Up @@ -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;
}
Comment thread
danirabbit marked this conversation as resolved.

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 () {
Expand Down