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
42 changes: 26 additions & 16 deletions src/Widgets/MultitaskingView/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
private ActorTarget workspaces;
private Clutter.Actor primary_monitor_container;
private Clutter.BrightnessContrastEffect brightness_effect;
private BackgroundManager? blurred_bg = null;

private GLib.Settings gala_behavior_settings;
private Drawing.StyleManager style_manager;
Expand Down Expand Up @@ -74,14 +75,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone

icon_groups = new IconGroupContainer (display.get_monitor_scale (display.get_primary_monitor ()));

brightness_effect = new Clutter.BrightnessContrastEffect ();
update_brightness_effect ();

var blurred_bg = new BackgroundManager (display, display.get_primary_monitor (), true, false);
blurred_bg.add_effect (new BlurEffect (blurred_bg, 18));
blurred_bg.add_effect (brightness_effect);

add_child (blurred_bg);
update_blurred_bg ();

// Create a child container that will be sized to fit the primary monitor, to contain the "main"
// multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
Expand Down Expand Up @@ -118,19 +112,12 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
style_manager.notify["prefers-color-scheme"].connect (update_brightness_effect);
}

private void update_brightness_effect () {
if (style_manager.prefers_color_scheme == DARK) {
brightness_effect.set_brightness (-0.4f);
} else {
brightness_effect.set_brightness (0.4f);
}
}

/**
* Places the primary container for the WorkspaceClones and the
* MonitorClones at the right positions
*/
private void update_monitors () {
update_blurred_bg ();
update_workspaces ();

foreach (var monitor_clone in window_containers_monitors) {
Expand Down Expand Up @@ -169,6 +156,29 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
}
}

private void update_brightness_effect () {
if (style_manager.prefers_color_scheme == DARK) {
brightness_effect.set_brightness (-0.4f);
} else {
brightness_effect.set_brightness (0.4f);
}
}

private void update_blurred_bg () {
if (blurred_bg != null) {
remove_child (blurred_bg);
}

brightness_effect = new Clutter.BrightnessContrastEffect ();
update_brightness_effect ();

blurred_bg = new BackgroundManager (display, display.get_primary_monitor (), true, false);
blurred_bg.add_effect (new BlurEffect (blurred_bg, 18));
blurred_bg.add_effect (brightness_effect);

insert_child_below (blurred_bg, null);
}

private void update_workspaces () {
foreach (unowned var child in workspaces.get_children ()) {
unowned var workspace_clone = (WorkspaceClone) child;
Expand Down
Loading