@@ -38,6 +38,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
3838 private ActorTarget workspaces;
3939 private Clutter . Actor primary_monitor_container;
4040 private Clutter . BrightnessContrastEffect brightness_effect;
41+ private BackgroundManager ? blurred_bg = null ;
4142
4243 private GLib . Settings gala_behavior_settings;
4344 private Drawing . StyleManager style_manager;
@@ -74,14 +75,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
7475
7576 icon_groups = new IconGroupContainer (display. get_monitor_scale (display. get_primary_monitor ()));
7677
77- brightness_effect = new Clutter .BrightnessContrastEffect ();
78- update_brightness_effect ();
79-
80- var blurred_bg = new BackgroundManager (display, display. get_primary_monitor (), true , false );
81- blurred_bg. add_effect (new BlurEffect (blurred_bg, 18 ));
82- blurred_bg. add_effect (brightness_effect);
83-
84- add_child (blurred_bg);
78+ update_blurred_bg ();
8579
8680 // Create a child container that will be sized to fit the primary monitor, to contain the "main"
8781 // multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
@@ -118,19 +112,12 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
118112 style_manager. notify[" prefers-color-scheme" ]. connect (update_brightness_effect);
119113 }
120114
121- private void update_brightness_effect () {
122- if (style_manager. prefers_color_scheme == DARK ) {
123- brightness_effect. set_brightness (- 0.4f );
124- } else {
125- brightness_effect. set_brightness (0.4f );
126- }
127- }
128-
129115 /**
130116 * Places the primary container for the WorkspaceClones and the
131117 * MonitorClones at the right positions
132118 */
133119 private void update_monitors () {
120+ update_blurred_bg ();
134121 update_workspaces ();
135122
136123 foreach (var monitor_clone in window_containers_monitors) {
@@ -169,6 +156,29 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
169156 }
170157 }
171158
159+ private void update_brightness_effect () {
160+ if (style_manager. prefers_color_scheme == DARK ) {
161+ brightness_effect. set_brightness (- 0.4f );
162+ } else {
163+ brightness_effect. set_brightness (0.4f );
164+ }
165+ }
166+
167+ private void update_blurred_bg () {
168+ if (blurred_bg != null ) {
169+ remove_child (blurred_bg);
170+ }
171+
172+ brightness_effect = new Clutter .BrightnessContrastEffect ();
173+ update_brightness_effect ();
174+
175+ blurred_bg = new BackgroundManager (display, display. get_primary_monitor (), true , false );
176+ blurred_bg. add_effect (new BlurEffect (blurred_bg, 18 ));
177+ blurred_bg. add_effect (brightness_effect);
178+
179+ insert_child_below (blurred_bg, null );
180+ }
181+
172182 private void update_workspaces () {
173183 foreach (unowned var child in workspaces. get_children ()) {
174184 unowned var workspace_clone = (WorkspaceClone ) child;
0 commit comments