Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/coverflow_alt_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const CoverflowAltTabBlur = class CoverflowAltTabBlur {
}

remove_background_actors() {
this.background_actors.forEach((actor) => actor.destroy);
this.background_actors.forEach((actor) => actor.destroy());
this.background_actors = [];

this.background_managers.forEach((background_manager) => {
Expand Down
37 changes: 31 additions & 6 deletions src/components/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const PANEL_STYLES = [
"contrasted-panel"
];

// global listener, so we don't miss the panel destruction event
let isMainPanelAlive = true;
Main.panel.connect('destroy', () => isMainPanelAlive = false);

export const PanelBlur = class PanelBlur {
constructor(connections, settings, effects_manager) {
Expand All @@ -28,6 +31,11 @@ export const PanelBlur = class PanelBlur {
}

enable() {
if (this.enabled) {
this._log("blur already enabled");
return;
}

this._log("blurring top panel");

// check for panels when Dash to Panel is activated
Expand Down Expand Up @@ -64,6 +72,11 @@ export const PanelBlur = class PanelBlur {
}

reset() {
if (!this.enabled) {
this._log("reset called but blur is not enabled");
return;
}

this._log("resetting...");

this.disable();
Expand All @@ -77,7 +90,7 @@ export const PanelBlur = class PanelBlur {
// blur already existing ones
if (global.dashToPanel.panels)
this.blur_dtp_panels();
} else {
} else if (isMainPanelAlive) {
// if no dash-to-panel, blur the main and only panel
this.maybe_blur_panel(Main.panel);
}
Expand All @@ -92,24 +105,26 @@ export const PanelBlur = class PanelBlur {
if (!global.dashToPanel?.panels) {
return GLib.SOURCE_REMOVE;
}

this._log("Blurring Dash to Panel panels after idle.");

// blur every panel found
global.dashToPanel.panels.forEach(p => {
this.maybe_blur_panel(p.panel);
});

// if main panel is not included in the previous panels, blur it
if (
!global.dashToPanel.panels
.map(p => p.panel)
.includes(Main.panel)
&&
this.settings.dash_to_panel.BLUR_ORIGINAL_PANEL
&&
isMainPanelAlive
)
this.maybe_blur_panel(Main.panel);

return GLib.SOURCE_REMOVE;
});
};
Expand Down Expand Up @@ -377,6 +392,11 @@ 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");
return;
}

if (this.settings.panel.FORCE_LIGHT_TEXT && !disable)
Main.panel.add_style_class_name("panel-light-text");
else
Expand Down Expand Up @@ -408,7 +428,7 @@ export const PanelBlur = class PanelBlur {
/// Update the visibility of the blur effect
update_visibility() {
if (
Main.panel.has_style_pseudo_class('overview')
isMainPanelAlive && Main.panel.has_style_pseudo_class('overview')
|| !Main.sessionMode.hasWindows
) {
this.actors_list.forEach(
Expand Down Expand Up @@ -533,6 +553,11 @@ export const PanelBlur = class PanelBlur {
}

disable() {
if (!this.enabled) {
this._log("blur already removed");
return;
}

this._log("removing blur from top panel");

this.disconnect_from_windows_and_overview();
Expand Down