Skip to content
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
26 changes: 18 additions & 8 deletions wingpanel-interface/BackgroundManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ public class WingpanelInterface.BackgroundManager : Object {
check_for_state_change (MINIMIZE_DURATION);
});

window.notify["fullscreen"].connect (() => {
check_for_state_change (SNAP_DURATION);
});

window.workspace_changed.connect (() => {
check_for_state_change (WORKSPACE_SWITCH_DURATION);
});
Expand Down Expand Up @@ -156,27 +160,33 @@ public class WingpanelInterface.BackgroundManager : Object {
* Check if Wingpanel's background state should change.
*
* The state is defined as follows:
* - If there's a maximized window, the state should be MAXIMIZED;
* - If there's a maximized or fullscreen window, the state should be MAXIMIZED;
* - If no information about the background could be gathered, it should be TRANSLUCENT;
* - If there's too much contrast or sharpness, it should be TRANSLUCENT;
* - If the background is too bright, it should be DARK;
* - Else it should be LIGHT.
*/
private void check_for_state_change (uint animation_duration) {
bool has_fullscreen_window = false;
bool has_maximized_window = false;

foreach (unowned Meta.Window window in current_workspace.list_windows ()) {
if (window.is_on_primary_monitor ()) {
if (!window.minimized && window.maximized_vertically) {
has_maximized_window = true;
break;
}
foreach (unowned var window in current_workspace.list_windows ()) {
if (!window.is_on_primary_monitor () || window.minimized) {
continue;
}

if (window.fullscreen) {
has_fullscreen_window = true;
} else if (window.maximized_vertically) {
has_maximized_window = true;
}
}

BackgroundState new_state;

if (has_maximized_window) {
if (has_fullscreen_window) {
new_state = BackgroundState.TRANSLUCENT_LIGHT;
} else if (has_maximized_window) {
new_state = BackgroundState.MAXIMIZED;
} else if (bk_color_info == null) {
new_state = BackgroundState.TRANSLUCENT_LIGHT;
Expand Down
Loading