Skip to content

Commit 3df558b

Browse files
lenemterdanirabbit
andauthored
Use translucent style with fullscreen window (#618)
* Use maximized style with fullscreen window * Set to translucent dark * Use TRANSLUCENT_LIGHT --------- Co-authored-by: Danielle Foré <[email protected]>
1 parent 30728ab commit 3df558b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

wingpanel-interface/BackgroundManager.vala

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public class WingpanelInterface.BackgroundManager : Object {
121121
check_for_state_change (MINIMIZE_DURATION);
122122
});
123123

124+
window.notify["fullscreen"].connect (() => {
125+
check_for_state_change (SNAP_DURATION);
126+
});
127+
124128
window.workspace_changed.connect (() => {
125129
check_for_state_change (WORKSPACE_SWITCH_DURATION);
126130
});
@@ -156,27 +160,33 @@ public class WingpanelInterface.BackgroundManager : Object {
156160
* Check if Wingpanel's background state should change.
157161
*
158162
* The state is defined as follows:
159-
* - If there's a maximized window, the state should be MAXIMIZED;
163+
* - If there's a maximized or fullscreen window, the state should be MAXIMIZED;
160164
* - If no information about the background could be gathered, it should be TRANSLUCENT;
161165
* - If there's too much contrast or sharpness, it should be TRANSLUCENT;
162166
* - If the background is too bright, it should be DARK;
163167
* - Else it should be LIGHT.
164168
*/
165169
private void check_for_state_change (uint animation_duration) {
170+
bool has_fullscreen_window = false;
166171
bool has_maximized_window = false;
167172

168-
foreach (unowned Meta.Window window in current_workspace.list_windows ()) {
169-
if (window.is_on_primary_monitor ()) {
170-
if (!window.minimized && window.maximized_vertically) {
171-
has_maximized_window = true;
172-
break;
173-
}
173+
foreach (unowned var window in current_workspace.list_windows ()) {
174+
if (!window.is_on_primary_monitor () || window.minimized) {
175+
continue;
176+
}
177+
178+
if (window.fullscreen) {
179+
has_fullscreen_window = true;
180+
} else if (window.maximized_vertically) {
181+
has_maximized_window = true;
174182
}
175183
}
176184

177185
BackgroundState new_state;
178186

179-
if (has_maximized_window) {
187+
if (has_fullscreen_window) {
188+
new_state = BackgroundState.TRANSLUCENT_LIGHT;
189+
} else if (has_maximized_window) {
180190
new_state = BackgroundState.MAXIMIZED;
181191
} else if (bk_color_info == null) {
182192
new_state = BackgroundState.TRANSLUCENT_LIGHT;

0 commit comments

Comments
 (0)