diff options
Diffstat (limited to 'raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components')
3 files changed, 91 insertions, 14 deletions
diff --git a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/applications.js b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/applications.js index e783046..5280b55 100644 --- a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/applications.js +++ b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/applications.js @@ -166,7 +166,7 @@ export const ApplicationsBlur = class ApplicationsBlur { let window_actor = meta_window.get_compositor_private(); if ( - (!meta_window.get_workspace().active) || meta_window.minimized + (!meta_window.get_workspace().active) || meta_window.minimized ) window_actor.hide(); }); @@ -385,10 +385,27 @@ export const ApplicationsBlur = class ApplicationsBlur { // set the window actor's opacity this.set_window_opacity(window_actor, this.settings.applications.OPACITY); + // update corner radius based on window state + this.update_corner_radius(meta_window); + // now set up the signals, for the window actor only: they are disconnected // in `remove_blur`, whereas the signals for the meta window are disconnected // only when the whole component is disabled + // listen for window state changes (maximized/fullscreen) + this.connections.connect( + meta_window, 'notify::maximized-horizontally', + _ => this.update_corner_radius(meta_window) + ); + this.connections.connect( + meta_window, 'notify::maximized-vertically', + _ => this.update_corner_radius(meta_window) + ); + this.connections.connect( + meta_window, 'notify::fullscreen', + _ => this.update_corner_radius(meta_window) + ); + // update the window opacity when it changes, else we don't control it fully this.connections.connect( window_actor, 'notify::opacity', @@ -472,6 +489,33 @@ export const ApplicationsBlur = class ApplicationsBlur { ); } + /// Update the corner radius based on window state (0 for maximized/fullscreen) + /// if the preferences say so. + update_corner_radius(meta_window) { + const is_maximized = meta_window.maximized_horizontally || meta_window.maximized_vertically; + const is_fullscreen = meta_window.fullscreen; + + let use_0_radius = !this.settings.applications.CORNER_WHEN_MAXIMIZED && (is_maximized || is_fullscreen); + + if (this.settings.applications.STATIC_BLUR) { + meta_window.bg_manager?._bms_pipeline?.effects.forEach(effect => { + if (effect.constructor.name === "CornerEffect") + effect.straight_corners = use_0_radius; + }) + } else { + if (meta_window.bg_manager?._bms_pipeline?.effect) + meta_window.bg_manager._bms_pipeline.effect.corner_radius = use_0_radius ? + 0 : this.settings.applications.CORNER_RADIUS; + } + } + + /// Update all corners, to use when the setting has been changed. + update_all_corner_radii() { + this.meta_window_map.forEach( + (meta_window, _pid) => this.update_corner_radius(meta_window) + ) + } + /// Set the opacity of the window actor that sits on top of the blur effect. set_window_opacity(window_actor, opacity) { window_actor?.get_children().forEach(child => { @@ -503,10 +547,7 @@ export const ApplicationsBlur = class ApplicationsBlur { this.mutter_gsettings .get_strv('experimental-features') .includes('scale-monitor-framebuffer'); - const is_wayland = gnome_shell_major_version >= 50 || - (typeof Meta.is_wayland_compositor === 'function' - ? Meta.is_wayland_compositor() - : global.display?.is_wayland_compositor?.() ?? true); + const is_wayland = gnome_shell_major_version >= 50 || Meta.is_wayland_compositor(); const monitor_index = meta_window.get_monitor(); // check if the window is using wayland, or xwayland/xorg for rendering return !scale_monitor_framebuffer && is_wayland && meta_window.get_client_type() == 0 diff --git a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/overview.js b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/overview.js index 50a625e..3bbde61 100644 --- a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/overview.js +++ b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/overview.js @@ -149,11 +149,14 @@ export const OverviewBlur = class OverviewBlur { // add the container widget for the overview only to the overview group Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0); // make sure it stays below + let _reordering = false; this.connections.connect(Main.layoutManager.overviewGroup, "child-added", (_, child) => { - if (child !== this.overview_background_group) { + if (!_reordering && child !== this.overview_background_group) { + _reordering = true; if (this.overview_background_group.get_parent()) Main.layoutManager.overviewGroup.remove_child(this.overview_background_group); Main.layoutManager.overviewGroup.insert_child_at_index(this.overview_background_group, 0); + _reordering = false; } }); } diff --git a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/panel.js b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/panel.js index 6c084cf..bd39166 100644 --- a/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/panel.js +++ b/raveos-gnome-theme/theme-data/extensions/installed/blur-my-shell@aunetx/components/panel.js @@ -63,11 +63,34 @@ export const PanelBlur = class PanelBlur { // the blur when a window is near a panel this.connect_to_windows_and_overview(); - // connect to workareas change - this.connections.connect(global.display, 'workareas-changed', - _ => this.reset() + // connect to monitors change, and set a dirty flag to tell the extension that it should be + // reset on 'workareas-changed' signal + this._dirty = false; + this.connections.connect(Main.layoutManager, 'monitors-changed', + _ => this._dirty = true ); + this.connections.connect(global.display, 'workareas-changed', _ => { + if (this._dirty) { + // the monitors chaned + this.reset(); + this._dirty = false; + } + else { + // blur panels created by extension multi-monitors-bar@frederykabryan + // I would like to connect directly to Main.uiGroup 'child-added' but it seems + // like the name is updated too late... + Main.uiGroup.get_children().forEach(child => { + if (child.get_name() === "panelBox" && + child != Main.layoutManager.panelBox && + child.get_n_children() == 1 + ) { + this.maybe_blur_panel(child.get_child_at_index(0)); + } + }); + } + }) + this.enabled = true; } @@ -95,8 +118,18 @@ export const PanelBlur = class PanelBlur { if (this.settings.dash_to_panel.BLUR_ORIGINAL_PANEL && isMainPanelAlive) this.maybe_blur_panel(Main.panel); } else { - // if no dash-to-panel, blur the main and only panel - this.maybe_blur_panel(Main.panel); + // if no dash-to-panel, blur the main panel + if (isMainPanelAlive) + this.maybe_blur_panel(Main.panel); + + // blur panels already created by extension multi-monitors-bar@frederykabryan + Main.uiGroup.get_children().forEach(actor => { + if (actor.get_name() === "panelBox" && actor.get_n_children() === 1) { + let multi_monitor_panel = actor.get_child_at_index(0); + if (isMainPanelAlive && multi_monitor_panel != Main.panel) + this.maybe_blur_panel(multi_monitor_panel); + } + }) } } @@ -385,10 +418,8 @@ export const PanelBlur = class PanelBlur { /// Update the css classname of the panel for light theme update_light_text_classname(disable = false) { - if (!isMainPanelAlive) { - this._log("cannot update light text classname, Main.panel is not alive"); + if (!isMainPanelAlive) return; - } if (this.settings.panel.FORCE_LIGHT_TEXT && !disable) Main.panel.add_style_class_name("panel-light-text"); @@ -561,6 +592,8 @@ export const PanelBlur = class PanelBlur { immutable_actors_list.forEach(actors => this.destroy_blur(actors, false)); this.actors_list = []; + this._dirty = true; + this.connections.disconnect_all(); this.enabled = false; |