[gnome] Update extensions for v46
This commit is contained in:
@ -37,11 +37,11 @@ let _zoomAndFadeIn = function () {
|
||||
|
||||
let blur_effect = this.get_effect("appfolder-blur");
|
||||
|
||||
blur_effect.sigma = 0;
|
||||
blur_effect.radius = 0;
|
||||
blur_effect.brightness = 1.0;
|
||||
Tweener.addTween(blur_effect,
|
||||
{
|
||||
sigma: sigma,
|
||||
radius: sigma * 2,
|
||||
brightness: brightness,
|
||||
time: FOLDER_DIALOG_ANIMATION_TIME / 1000,
|
||||
transition: 'easeOutQuad'
|
||||
@ -85,7 +85,7 @@ let _zoomAndFadeOut = function () {
|
||||
let blur_effect = this.get_effect("appfolder-blur");
|
||||
Tweener.addTween(blur_effect,
|
||||
{
|
||||
sigma: 0,
|
||||
radius: 0,
|
||||
brightness: 1.0,
|
||||
time: FOLDER_DIALOG_ANIMATION_TIME / 1000,
|
||||
transition: 'easeInQuad'
|
||||
@ -165,7 +165,7 @@ export const AppFoldersBlur = class AppFoldersBlur {
|
||||
|
||||
let blur_effect = new Shell.BlurEffect({
|
||||
name: "appfolder-blur",
|
||||
sigma: sigma,
|
||||
radius: sigma * 2,
|
||||
brightness: brightness,
|
||||
mode: Shell.BlurMode.BACKGROUND
|
||||
});
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
import Shell from 'gi://Shell';
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Meta from 'gi://Meta';
|
||||
import Gio from 'gi://Gio';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
|
||||
import { PaintSignals } from '../effects/paint_signals.js';
|
||||
import { ApplicationsService } from '../dbus/services.js';
|
||||
|
||||
|
||||
export const ApplicationsBlur = class ApplicationsBlur {
|
||||
constructor(connections, settings, _) {
|
||||
this.connections = connections;
|
||||
this.settings = settings;
|
||||
this.paint_signals = new PaintSignals(connections);
|
||||
|
||||
this.mutter_gsettings = new Gio.Settings({ schema: 'org.gnome.mutter' });
|
||||
|
||||
// stores every blurred window
|
||||
this.window_map = new Map();
|
||||
// stores every blur actor
|
||||
@ -67,14 +69,11 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
this.connections.connect(
|
||||
Main.overview, 'hidden',
|
||||
_ => {
|
||||
let active_workspace =
|
||||
global.workspace_manager.get_active_workspace();
|
||||
|
||||
this.window_map.forEach((meta_window, _pid) => {
|
||||
let window_actor = meta_window.get_compositor_private();
|
||||
|
||||
if (
|
||||
meta_window.get_workspace() !== active_workspace
|
||||
!meta_window.get_workspace().active
|
||||
)
|
||||
window_actor.hide();
|
||||
});
|
||||
@ -325,7 +324,7 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
/// Add the blur effect to the window.
|
||||
create_blur_effect(pid, window_actor, meta_window, brightness, sigma) {
|
||||
let blur_effect = new Shell.BlurEffect({
|
||||
sigma: sigma,
|
||||
radius: sigma * 2,
|
||||
brightness: brightness,
|
||||
mode: Shell.BlurMode.BACKGROUND
|
||||
});
|
||||
@ -420,13 +419,15 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
}
|
||||
|
||||
/// Compute the size and position for a blur actor.
|
||||
/// On wayland, it seems like we need to divide by the scale to get the
|
||||
/// correct result.
|
||||
/// If `scale-monitor-framebuffer` experimental feature if on, we don't need to manage scaling.
|
||||
/// Else, on wayland, we need to divide by the scale to get the correct result.
|
||||
compute_allocation(meta_window) {
|
||||
const scale_monitor_framebuffer = this.mutter_gsettings.get_strv('experimental-features')
|
||||
.includes('scale-monitor-framebuffer');
|
||||
const is_wayland = Meta.is_wayland_compositor();
|
||||
const monitor_index = meta_window.get_monitor();
|
||||
// check if the window is using wayland, or xwayland/xorg for rendering
|
||||
const scale = is_wayland && meta_window.get_client_type() == 0
|
||||
const scale = !scale_monitor_framebuffer && is_wayland && meta_window.get_client_type() == 0
|
||||
? Main.layoutManager.monitors[monitor_index].geometry_scale
|
||||
: 1;
|
||||
|
||||
@ -464,7 +465,7 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
/// Updates the blur effect by overwriting its sigma and brightness values.
|
||||
update_blur_effect(blur_actor, brightness, sigma) {
|
||||
let effect = blur_actor.get_effect('blur-effect');
|
||||
effect.sigma = sigma;
|
||||
effect.radius = sigma * 2;
|
||||
effect.brightness = brightness;
|
||||
}
|
||||
|
||||
@ -500,6 +501,7 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
this._log("removing blur from applications...");
|
||||
|
||||
this.service?.unexport();
|
||||
delete this.mutter_gsettings;
|
||||
|
||||
this.blur_actor_map.forEach(((_blur_actor, pid) => {
|
||||
this.remove_blur(pid);
|
||||
@ -545,4 +547,4 @@ export const ApplicationsBlur = class ApplicationsBlur {
|
||||
if (this.settings.DEBUG)
|
||||
console.log(`[Blur my Shell > applications] ${str}`);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
import St from 'gi://St';
|
||||
import Shell from 'gi://Shell';
|
||||
import Meta from 'gi://Meta';
|
||||
import Mtk from 'gi://Mtk';
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
const Signals = imports.signals;
|
||||
|
||||
import { PaintSignals } from '../effects/paint_signals.js';
|
||||
import { BlurEffect } from '../effects/blur_effect.js';
|
||||
|
||||
const DASH_STYLES = [
|
||||
"transparent-dash",
|
||||
@ -12,72 +15,191 @@ const DASH_STYLES = [
|
||||
];
|
||||
|
||||
|
||||
// An helper function to find the monitor in which an actor is situated,
|
||||
/// there might be a pre-existing function in GLib already
|
||||
function find_monitor_for(actor) {
|
||||
let extents = actor.get_transformed_extents();
|
||||
let rect = new Mtk.Rectangle({
|
||||
x: extents.get_x(),
|
||||
y: extents.get_y(),
|
||||
width: extents.get_width(),
|
||||
height: extents.get_height(),
|
||||
});
|
||||
|
||||
let index = global.display.get_monitor_index_for_rect(rect);
|
||||
|
||||
return Main.layoutManager.monitors[index];
|
||||
}
|
||||
|
||||
|
||||
/// This type of object is created for every dash found, and talks to the main
|
||||
/// DashBlur thanks to signals.
|
||||
///
|
||||
/// This allows to dynamically track the created dashes for each screen.
|
||||
class DashInfos {
|
||||
constructor(dash_blur, dash, background_parent, effect, settings) {
|
||||
constructor(dash_blur, dash, dash_container, dash_background, background, background_parent, effect) {
|
||||
// the parent DashBlur object, to communicate
|
||||
this.dash_blur = dash_blur;
|
||||
this.dash_container = dash_container;
|
||||
// the blurred dash
|
||||
this.dash = dash;
|
||||
this.dash_background = dash_background;
|
||||
this.background_parent = background_parent;
|
||||
this.background = background;
|
||||
this.effect = effect;
|
||||
this.settings = settings;
|
||||
this.settings = dash_blur.settings;
|
||||
this.old_style = this.dash._background.style;
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'remove-dashes', () => {
|
||||
this._log("removing blur from dash");
|
||||
this.dash.get_parent().remove_child(this.background_parent);
|
||||
this.dash._background.style = this.old_style;
|
||||
|
||||
DASH_STYLES.forEach(
|
||||
style => this.dash.remove_style_class_name(style)
|
||||
);
|
||||
this.remove_style();
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'update-sigma', () => {
|
||||
this.effect.sigma = this.dash_blur.sigma;
|
||||
if (this.dash_blur.is_static) {
|
||||
this.dash_blur.update_size();
|
||||
}
|
||||
this.effect.radius = 2 * this.dash_blur.sigma * this.effect.scale;
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'update-brightness', () => {
|
||||
this.effect.brightness = this.dash_blur.brightness;
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'override-background', () => {
|
||||
this.dash._background.style = null;
|
||||
dash_blur.connections.connect(dash_blur, 'update-corner-radius', () => {
|
||||
if (this.dash_blur.is_static) {
|
||||
let monitor = find_monitor_for(this.dash);
|
||||
let corner_radius = this.dash_blur.corner_radius * monitor.geometry_scale;
|
||||
this.effect.corner_radius = Math.min(
|
||||
corner_radius, this.effect.width / 2, this.effect.height / 2
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
DASH_STYLES.forEach(
|
||||
style => this.dash.remove_style_class_name(style)
|
||||
);
|
||||
dash_blur.connections.connect(dash_blur, 'override-background', () => {
|
||||
this.remove_style();
|
||||
|
||||
this.dash.set_style_class_name(
|
||||
DASH_STYLES[this.settings.dash_to_dock.STYLE_DASH_TO_DOCK]
|
||||
);
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'reset-background', () => {
|
||||
this.dash._background.style = this.old_style;
|
||||
|
||||
DASH_STYLES.forEach(
|
||||
style => this.dash.remove_style_class_name(style)
|
||||
);
|
||||
});
|
||||
dash_blur.connections.connect(dash_blur, 'reset-background', () => this.remove_style());
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'show', () => {
|
||||
this.effect.sigma = this.dash_blur.sigma;
|
||||
if (this.dash_blur.is_static)
|
||||
this.background_parent.show();
|
||||
else
|
||||
this.effect.radius = this.dash_blur.sigma * 2 * this.effect.scale;
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'hide', () => {
|
||||
this.effect.sigma = 0;
|
||||
if (this.dash_blur.is_static)
|
||||
this.background_parent.hide();
|
||||
else
|
||||
this.effect.radius = 0;
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'update-wallpaper', () => {
|
||||
if (this.dash_blur.is_static) {
|
||||
let bg = Main.layoutManager._backgroundGroup.get_child_at_index(
|
||||
Main.layoutManager.monitors.length
|
||||
- find_monitor_for(this.dash).index - 1
|
||||
);
|
||||
if (bg && bg.get_content()) {
|
||||
this.background.content.set({
|
||||
background: bg.get_content().background
|
||||
});
|
||||
this._log('wallpaper updated');
|
||||
} else {
|
||||
this._warn("could not get background for dash-to-dock");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'update-size', () => {
|
||||
if (this.dash_blur.is_static) {
|
||||
let [x, y] = this.get_dash_position(this.dash_container, this.dash_background);
|
||||
|
||||
this.background.x = -x;
|
||||
this.background.y = -y;
|
||||
|
||||
this.effect.width = this.dash_background.width;
|
||||
this.effect.height = this.dash_background.height;
|
||||
|
||||
this.dash_blur.set_corner_radius(this.dash_blur.corner_radius);
|
||||
|
||||
if (dash_container.get_style_class_name().includes("top")) {
|
||||
this.background.set_clip(x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height);
|
||||
} else if (dash_container.get_style_class_name().includes("bottom")) {
|
||||
this.background.set_clip(x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height);
|
||||
} else if (dash_container.get_style_class_name().includes("left")) {
|
||||
this.background.set_clip(x + this.dash.x + this.dash_background.x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height);
|
||||
} else if (dash_container.get_style_class_name().includes("right")) {
|
||||
this.background.set_clip(x + this.dash.x + this.dash_background.x, y + this.dash.y + this.dash_background.y, this.dash_background.width, this.dash_background.height);
|
||||
}
|
||||
} else {
|
||||
this.background.width = this.dash_background.width;
|
||||
this.background.height = this.dash_background.height;
|
||||
|
||||
this.background.x = this.dash_background.x;
|
||||
this.background.y = this.dash_background.y + this.dash.y;
|
||||
}
|
||||
});
|
||||
|
||||
dash_blur.connections.connect(dash_blur, 'change-blur-type', () => {
|
||||
this.background_parent.remove_child(this.background);
|
||||
if (this.effect.chained_effect)
|
||||
this.effect.get_actor()?.remove_effect(this.effect.chained_effect);
|
||||
this.effect.get_actor()?.remove_effect(this.effect);
|
||||
|
||||
let [background, effect] = this.dash_blur.add_blur(this.dash, this.dash_background, this.dash_container);
|
||||
this.background = background;
|
||||
this.effect = effect;
|
||||
this.background_parent.add_child(this.background);
|
||||
});
|
||||
}
|
||||
|
||||
remove_style() {
|
||||
this.dash._background.style = this.old_style;
|
||||
|
||||
DASH_STYLES.forEach(
|
||||
style => this.dash.remove_style_class_name(style)
|
||||
);
|
||||
}
|
||||
|
||||
get_dash_position(dash_container, dash_background) {
|
||||
var x, y;
|
||||
|
||||
let monitor = find_monitor_for(dash_container);
|
||||
let dash_box = dash_container._slider.get_child();
|
||||
|
||||
if (dash_container.get_style_class_name().includes("top")) {
|
||||
x = (monitor.width - dash_background.width) / 2;
|
||||
y = dash_box.y;
|
||||
} else if (dash_container.get_style_class_name().includes("bottom")) {
|
||||
x = (monitor.width - dash_background.width) / 2;
|
||||
y = monitor.height - dash_container.height;
|
||||
} else if (dash_container.get_style_class_name().includes("left")) {
|
||||
x = dash_box.x;
|
||||
y = dash_container.y + (dash_container.height - dash_background.height) / 2 - dash_background.y;
|
||||
} else if (dash_container.get_style_class_name().includes("right")) {
|
||||
x = monitor.width - dash_container.width;
|
||||
y = dash_container.y + (dash_container.height - dash_background.height) / 2 - dash_background.y;
|
||||
}
|
||||
|
||||
return [x, y];
|
||||
}
|
||||
|
||||
_log(str) {
|
||||
if (this.settings.DEBUG)
|
||||
console.log(`[Blur my Shell > dash] ${str}`);
|
||||
}
|
||||
|
||||
_warn(str) {
|
||||
console.warn(`[Blur my Shell > dash] ${str}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const DashBlur = class DashBlur {
|
||||
@ -92,11 +214,13 @@ export const DashBlur = class DashBlur {
|
||||
this.brightness = this.settings.dash_to_dock.CUSTOMIZE
|
||||
? this.settings.dash_to_dock.BRIGHTNESS
|
||||
: this.settings.BRIGHTNESS;
|
||||
this.corner_radius = this.settings.dash_to_dock.CORNER_RADIUS;
|
||||
this.is_static = this.settings.dash_to_dock.STATIC_BLUR;
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
enable() {
|
||||
this.connections.connect(Main.uiGroup, 'actor-added', (_, actor) => {
|
||||
this.connections.connect(Main.uiGroup, 'child-added', (_, actor) => {
|
||||
if (
|
||||
(actor.get_name() === "dashtodockContainer") &&
|
||||
(actor.constructor.name === 'DashToDock')
|
||||
@ -107,6 +231,9 @@ export const DashBlur = class DashBlur {
|
||||
this.blur_existing_dashes();
|
||||
this.connect_to_overview();
|
||||
|
||||
this.update_wallpaper();
|
||||
this.update_size();
|
||||
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
@ -143,13 +270,6 @@ export const DashBlur = class DashBlur {
|
||||
|
||||
// Blurs the dash and returns a `DashInfos` containing its information
|
||||
blur_dash_from(dash, dash_container) {
|
||||
// the effect to be applied
|
||||
let effect = new Shell.BlurEffect({
|
||||
brightness: this.brightness,
|
||||
sigma: this.sigma,
|
||||
mode: Shell.BlurMode.BACKGROUND
|
||||
});
|
||||
|
||||
// dash background parent, not visible
|
||||
let background_parent = new St.Widget({
|
||||
name: 'dash-blurred-background-parent',
|
||||
@ -158,92 +278,50 @@ export const DashBlur = class DashBlur {
|
||||
height: 0
|
||||
});
|
||||
|
||||
// dash background widget
|
||||
let background = new St.Widget({
|
||||
name: 'dash-blurred-background',
|
||||
style_class: 'dash-blurred-background',
|
||||
x: 0,
|
||||
y: dash_container._slider.y,
|
||||
width: dash.width,
|
||||
height: dash.height,
|
||||
// finally blur the dash
|
||||
let dash_background = dash.get_children().find(child => {
|
||||
return child.get_style_class_name() === 'dash-background';
|
||||
});
|
||||
|
||||
let [background, effect] = this.add_blur(dash, dash_background, dash_container);
|
||||
|
||||
this.update_wallpaper();
|
||||
this.update_size();
|
||||
|
||||
// updates size and position on change
|
||||
this.connections.connect(dash_container._slider, 'notify::y', _ => {
|
||||
background.y = dash_container._slider.y;
|
||||
});
|
||||
this.connections.connect(dash, 'notify::width', _ => {
|
||||
background.width = dash.width;
|
||||
this.update_size();
|
||||
});
|
||||
this.connections.connect(dash, 'notify::height', _ => {
|
||||
background.height = dash.height;
|
||||
this.update_size();
|
||||
});
|
||||
this.connections.connect(dash_container, 'notify::width', _ => {
|
||||
this.update_size();
|
||||
});
|
||||
this.connections.connect(dash_container, 'notify::height', _ => {
|
||||
this.update_size();
|
||||
});
|
||||
this.connections.connect(dash_container, 'notify::y', _ => {
|
||||
this.update_wallpaper();
|
||||
this.update_size();
|
||||
});
|
||||
this.connections.connect(dash_container, 'notify::x', _ => {
|
||||
this.update_wallpaper();
|
||||
this.update_size();
|
||||
});
|
||||
|
||||
// add the widget to the dash
|
||||
background.add_effect(effect);
|
||||
background_parent.add_child(background);
|
||||
dash.get_parent().insert_child_at_index(background_parent, 0);
|
||||
|
||||
// HACK
|
||||
//
|
||||
//`Shell.BlurEffect` does not repaint when shadows are under it. [1]
|
||||
//
|
||||
// This does not entirely fix this bug (shadows caused by windows
|
||||
// still cause artifacts), but it prevents the shadows of the panel
|
||||
// buttons to cause artifacts on the panel itself
|
||||
//
|
||||
// [1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857
|
||||
|
||||
if (this.settings.HACKS_LEVEL === 1) {
|
||||
this._log("dash hack level 1");
|
||||
this.paint_signals.disconnect_all();
|
||||
|
||||
let rp = () => {
|
||||
effect.queue_repaint();
|
||||
};
|
||||
|
||||
dash._box.get_children().forEach((icon) => {
|
||||
try {
|
||||
let zone = icon.get_child_at_index(0);
|
||||
|
||||
this.connections.connect(zone, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
} catch (e) {
|
||||
this._warn(`${e}, continuing`);
|
||||
}
|
||||
});
|
||||
|
||||
this.connections.connect(dash._box, 'actor-added', (_, actor) => {
|
||||
try {
|
||||
let zone = actor.get_child_at_index(0);
|
||||
|
||||
this.connections.connect(zone, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
} catch (e) {
|
||||
this._warn(`${e}, continuing`);
|
||||
}
|
||||
});
|
||||
|
||||
let show_apps = dash._showAppsIcon;
|
||||
|
||||
this.connections.connect(show_apps, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
|
||||
this.connections.connect(dash, 'leave-event', rp);
|
||||
} else if (this.settings.HACKS_LEVEL === 2) {
|
||||
this._log("dash hack level 2");
|
||||
|
||||
this.paint_signals.connect(background, effect);
|
||||
} else {
|
||||
this.paint_signals.disconnect_all();
|
||||
}
|
||||
|
||||
// create infos
|
||||
let infos = new DashInfos(
|
||||
this, dash, background_parent, effect, this.settings
|
||||
this,
|
||||
dash,
|
||||
dash_container,
|
||||
dash_background,
|
||||
background,
|
||||
background_parent,
|
||||
effect
|
||||
);
|
||||
|
||||
// update the background
|
||||
@ -253,6 +331,128 @@ export const DashBlur = class DashBlur {
|
||||
return infos;
|
||||
}
|
||||
|
||||
add_blur(dash, dash_background, dash_container) {
|
||||
let monitor = find_monitor_for(dash);
|
||||
|
||||
// dash background widget
|
||||
let background = this.is_static
|
||||
? new Meta.BackgroundActor({
|
||||
meta_display: global.display,
|
||||
monitor: monitor.index,
|
||||
})
|
||||
: new St.Widget({
|
||||
name: 'dash-blurred-background',
|
||||
style_class: 'dash-blurred-background',
|
||||
x: dash_background.x,
|
||||
y: dash_background.y + dash.y,
|
||||
width: dash_background.width,
|
||||
height: dash_background.height,
|
||||
});
|
||||
|
||||
// the effect to be applied
|
||||
let effect;
|
||||
if (this.is_static) {
|
||||
let corner_radius = this.corner_radius * monitor.geometry_scale;
|
||||
corner_radius = Math.min(corner_radius, dash_background.width / 2, dash_background.height / 2);
|
||||
|
||||
effect = new BlurEffect({
|
||||
radius: 2 * this.sigma * monitor.geometry_scale,
|
||||
brightness: this.brightness,
|
||||
width: dash_background.width,
|
||||
height: dash_background.height,
|
||||
corner_radius: corner_radius
|
||||
});
|
||||
|
||||
// connect to every background change (even without changing image)
|
||||
// FIXME this signal is fired very often, so we should find another one
|
||||
// fired only when necessary (but that still catches all cases)
|
||||
this.connections.connect(
|
||||
Main.layoutManager._backgroundGroup,
|
||||
'notify',
|
||||
_ => this.update_wallpaper()
|
||||
);
|
||||
} else {
|
||||
effect = new Shell.BlurEffect({
|
||||
brightness: this.brightness,
|
||||
radius: this.sigma * 2 * monitor.geometry_scale,
|
||||
mode: Shell.BlurMode.BACKGROUND
|
||||
});
|
||||
|
||||
// HACK
|
||||
//
|
||||
//`Shell.BlurEffect` does not repaint when shadows are under it. [1]
|
||||
//
|
||||
// This does not entirely fix this bug (shadows caused by windows
|
||||
// still cause artifacts), but it prevents the shadows of the panel
|
||||
// buttons to cause artifacts on the panel itself
|
||||
//
|
||||
// [1]: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2857
|
||||
|
||||
if (this.settings.HACKS_LEVEL === 1) {
|
||||
this._log("dash hack level 1");
|
||||
this.paint_signals.disconnect_all();
|
||||
|
||||
let rp = () => {
|
||||
effect.queue_repaint();
|
||||
};
|
||||
|
||||
dash._box.get_children().forEach((icon) => {
|
||||
try {
|
||||
let zone = icon.get_child_at_index(0);
|
||||
|
||||
this.connections.connect(zone, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
} catch (e) {
|
||||
this._warn(`${e}, continuing`);
|
||||
}
|
||||
});
|
||||
|
||||
this.connections.connect(dash._box, 'actor-added', (_, actor) => {
|
||||
try {
|
||||
let zone = actor.get_child_at_index(0);
|
||||
|
||||
this.connections.connect(zone, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
} catch (e) {
|
||||
this._warn(`${e}, continuing`);
|
||||
}
|
||||
});
|
||||
|
||||
let show_apps = dash._showAppsIcon;
|
||||
|
||||
this.connections.connect(show_apps, [
|
||||
'enter-event', 'leave-event', 'button-press-event'
|
||||
], rp);
|
||||
|
||||
this.connections.connect(dash, 'leave-event', rp);
|
||||
} else if (this.settings.HACKS_LEVEL === 2) {
|
||||
this._log("dash hack level 2");
|
||||
|
||||
this.paint_signals.connect(background, effect);
|
||||
} else {
|
||||
this.paint_signals.disconnect_all();
|
||||
}
|
||||
}
|
||||
|
||||
// store the scale in the effect in order to retrieve it in set_sigma
|
||||
effect.scale = monitor.geometry_scale;
|
||||
|
||||
background.add_effect(effect);
|
||||
|
||||
return [background, effect];
|
||||
}
|
||||
|
||||
change_blur_type() {
|
||||
this.is_static = this.settings.dash_to_dock.STATIC_BLUR;
|
||||
this.emit('change-blur-type', true);
|
||||
|
||||
this.update_wallpaper();
|
||||
this.update_background();
|
||||
this.update_size();
|
||||
}
|
||||
|
||||
/// Connect when overview if opened/closed to hide/show the blur accordingly
|
||||
connect_to_overview() {
|
||||
this.connections.disconnect_all_for(Main.overview);
|
||||
@ -276,6 +476,15 @@ export const DashBlur = class DashBlur {
|
||||
this.emit('reset-background', true);
|
||||
}
|
||||
|
||||
update_wallpaper() {
|
||||
if (this.is_static)
|
||||
this.emit('update-wallpaper', true);
|
||||
}
|
||||
|
||||
update_size() {
|
||||
this.emit('update-size', true);
|
||||
}
|
||||
|
||||
set_sigma(sigma) {
|
||||
this.sigma = sigma;
|
||||
this.emit('update-sigma', true);
|
||||
@ -286,6 +495,11 @@ export const DashBlur = class DashBlur {
|
||||
this.emit('update-brightness', true);
|
||||
}
|
||||
|
||||
set_corner_radius(radius) {
|
||||
this.corner_radius = radius;
|
||||
this.emit('update-corner-radius', true);
|
||||
}
|
||||
|
||||
// not implemented for dynamic blur
|
||||
set_color(c) { }
|
||||
set_noise_amount(n) { }
|
||||
|
||||
@ -21,6 +21,7 @@ export const LockscreenBlur = class LockscreenBlur {
|
||||
this.connections = connections;
|
||||
this.settings = settings;
|
||||
this.effects_manager = effects_manager;
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
enable() {
|
||||
@ -43,6 +44,8 @@ export const LockscreenBlur = class LockscreenBlur {
|
||||
: this.settings.NOISE_LIGHTNESS;
|
||||
|
||||
this.update_lockscreen();
|
||||
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
update_lockscreen() {
|
||||
@ -64,7 +67,7 @@ export const LockscreenBlur = class LockscreenBlur {
|
||||
|
||||
let blur_effect = new Shell.BlurEffect({
|
||||
name: 'blur',
|
||||
sigma: sigma,
|
||||
radius: sigma * 2,
|
||||
brightness: brightness
|
||||
});
|
||||
|
||||
@ -118,7 +121,7 @@ export const LockscreenBlur = class LockscreenBlur {
|
||||
if (blur_effect) {
|
||||
blur_effect.set({
|
||||
brightness: brightness,
|
||||
sigma: sigma * blur_effect.scale,
|
||||
radius: sigma * 2 * blur_effect.scale,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -158,6 +161,8 @@ export const LockscreenBlur = class LockscreenBlur {
|
||||
original_updateBackgroundEffects;
|
||||
|
||||
this.connections.disconnect_all();
|
||||
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
_log(str) {
|
||||
|
||||
@ -160,6 +160,7 @@ export const OverviewBlur = class OverviewBlur {
|
||||
|
||||
create_background_actor(monitor, is_transition) {
|
||||
let bg_actor = new Meta.BackgroundActor({
|
||||
name: "blur-my-shell_background_actor",
|
||||
meta_display: global.display,
|
||||
monitor: monitor.index
|
||||
});
|
||||
@ -184,10 +185,9 @@ export const OverviewBlur = class OverviewBlur {
|
||||
brightness: this.settings.overview.CUSTOMIZE
|
||||
? this.settings.overview.BRIGHTNESS
|
||||
: this.settings.BRIGHTNESS,
|
||||
sigma: this.settings.overview.CUSTOMIZE
|
||||
radius: (this.settings.overview.CUSTOMIZE
|
||||
? this.settings.overview.SIGMA
|
||||
: this.settings.SIGMA
|
||||
* monitor.geometry_scale,
|
||||
: this.settings.SIGMA) * 2 * monitor.geometry_scale,
|
||||
mode: Shell.BlurMode.ACTOR
|
||||
});
|
||||
|
||||
@ -235,7 +235,7 @@ export const OverviewBlur = class OverviewBlur {
|
||||
|
||||
set_sigma(s) {
|
||||
this.effects.forEach(effect => {
|
||||
effect.blur_effect.sigma = s * effect.blur_effect.scale;
|
||||
effect.blur_effect.radius = s * 2 * effect.blur_effect.scale;
|
||||
});
|
||||
}
|
||||
|
||||
@ -264,13 +264,15 @@ export const OverviewBlur = class OverviewBlur {
|
||||
}
|
||||
|
||||
remove_background_actors() {
|
||||
Main.layoutManager.overviewGroup.get_children().forEach(actor => {
|
||||
if (actor.constructor.name === 'Meta_BackgroundActor') {
|
||||
actor.get_effects().forEach(effect => {
|
||||
Main.layoutManager.overviewGroup.get_children().forEach(child => {
|
||||
if (child instanceof Meta.BackgroundActor
|
||||
&& child.get_name() == "blur-my-shell_background_actor"
|
||||
) {
|
||||
child.get_effects().forEach(effect => {
|
||||
this.effects_manager.remove(effect);
|
||||
});
|
||||
Main.layoutManager.overviewGroup.remove_child(actor);
|
||||
actor.destroy();
|
||||
Main.layoutManager.overviewGroup.remove_child(child);
|
||||
child.destroy();
|
||||
}
|
||||
});
|
||||
this.effects = [];
|
||||
|
||||
@ -53,6 +53,9 @@ export const PanelBlur = class PanelBlur {
|
||||
// the blur when a window is near a panel
|
||||
this.connect_to_windows_and_overview();
|
||||
|
||||
// update the classname if the panel to have or have not light text
|
||||
this.update_light_text_classname();
|
||||
|
||||
// connect to every background change (even without changing image)
|
||||
// FIXME this signal is fired very often, so we should find another one
|
||||
// fired only when necessary (but that still catches all cases)
|
||||
@ -167,10 +170,9 @@ export const PanelBlur = class PanelBlur {
|
||||
brightness: this.settings.panel.CUSTOMIZE
|
||||
? this.settings.panel.BRIGHTNESS
|
||||
: this.settings.BRIGHTNESS,
|
||||
sigma: this.settings.panel.CUSTOMIZE
|
||||
radius: (this.settings.panel.CUSTOMIZE
|
||||
? this.settings.panel.SIGMA
|
||||
: this.settings.SIGMA
|
||||
* monitor.geometry_scale,
|
||||
: this.settings.SIGMA) * 2 * monitor.geometry_scale,
|
||||
mode: this.settings.panel.STATIC_BLUR
|
||||
? Shell.BlurMode.ACTOR
|
||||
: Shell.BlurMode.BACKGROUND
|
||||
@ -317,7 +319,7 @@ export const PanelBlur = class PanelBlur {
|
||||
Main.layoutManager.monitors.length
|
||||
- this.find_monitor_for(actors.widgets.panel).index - 1
|
||||
);
|
||||
if (bg)
|
||||
if (bg && bg.get_content())
|
||||
actors.widgets.background.content.set({
|
||||
background: bg.get_content().background
|
||||
});
|
||||
@ -408,6 +410,9 @@ export const PanelBlur = class PanelBlur {
|
||||
this.connections.connect(
|
||||
appDisplay, 'hide', this.show.bind(this)
|
||||
);
|
||||
this.connections.connect(
|
||||
Main.overview, 'hidden', this.show.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -436,10 +441,10 @@ export const PanelBlur = class PanelBlur {
|
||||
}
|
||||
|
||||
// manage windows at their creation/removal
|
||||
this.connections.connect(global.window_group, 'actor-added',
|
||||
this.connections.connect(global.window_group, 'child-added',
|
||||
this.on_window_actor_added.bind(this)
|
||||
);
|
||||
this.connections.connect(global.window_group, 'actor-removed',
|
||||
this.connections.connect(global.window_group, 'child-removed',
|
||||
this.on_window_actor_removed.bind(this)
|
||||
);
|
||||
|
||||
@ -487,6 +492,14 @@ export const PanelBlur = class PanelBlur {
|
||||
this.window_signal_ids = new Map();
|
||||
}
|
||||
|
||||
/// Update the css classname of the panel for light theme
|
||||
update_light_text_classname(disable = false) {
|
||||
if (this.settings.panel.FORCE_LIGHT_TEXT && !disable)
|
||||
Main.panel.add_style_class_name("panel-light-text");
|
||||
else
|
||||
Main.panel.remove_style_class_name("panel-light-text");
|
||||
}
|
||||
|
||||
/// Callback when a new window is added
|
||||
on_window_actor_added(container, meta_window_actor) {
|
||||
this.window_signal_ids.set(meta_window_actor, [
|
||||
@ -532,6 +545,7 @@ export const PanelBlur = class PanelBlur {
|
||||
&& meta_window.get_window_type() !== Meta.WindowType.DESKTOP
|
||||
// exclude Desktop Icons NG
|
||||
&& meta_window.get_gtk_application_id() !== "com.rastersoft.ding"
|
||||
&& meta_window.get_gtk_application_id() !== "com.desktop.ding"
|
||||
);
|
||||
|
||||
// check if at least one window is near enough to each panel and act
|
||||
@ -590,7 +604,7 @@ export const PanelBlur = class PanelBlur {
|
||||
/// enabling/disabling other effects.
|
||||
invalidate_blur(actors) {
|
||||
if (this.settings.panel.STATIC_BLUR && actors.widgets.background)
|
||||
actors.widgets.background.get_content().invalidate();
|
||||
actors.widgets.background.get_content()?.invalidate();
|
||||
}
|
||||
|
||||
invalidate_all_blur() {
|
||||
@ -599,7 +613,7 @@ export const PanelBlur = class PanelBlur {
|
||||
|
||||
set_sigma(s) {
|
||||
this.actors_list.forEach(actors => {
|
||||
actors.effects.blur.sigma = s * actors.effects.blur.scale;
|
||||
actors.effects.blur.radius = s * 2 * actors.effects.blur.scale;
|
||||
this.invalidate_blur(actors);
|
||||
});
|
||||
}
|
||||
@ -662,6 +676,8 @@ export const PanelBlur = class PanelBlur {
|
||||
|
||||
this.disconnect_from_windows_and_overview();
|
||||
|
||||
this.update_light_text_classname(true);
|
||||
|
||||
this.actors_list.forEach(actors => {
|
||||
this.set_should_override_panel(actors, false);
|
||||
this.effects_manager.remove(actors.effects.noise);
|
||||
|
||||
@ -82,10 +82,9 @@ export const ScreenshotBlur = class ScreenshotBlur {
|
||||
brightness: this.settings.screenshot.CUSTOMIZE
|
||||
? this.settings.screenshot.BRIGHTNESS
|
||||
: this.settings.BRIGHTNESS,
|
||||
sigma: this.settings.screenshot.CUSTOMIZE
|
||||
radius: (this.settings.screenshot.CUSTOMIZE
|
||||
? this.settings.screenshot.SIGMA
|
||||
: this.settings.SIGMA
|
||||
* monitor.geometry_scale,
|
||||
: this.settings.SIGMA) * 2 * monitor.geometry_scale,
|
||||
mode: Shell.BlurMode.ACTOR
|
||||
});
|
||||
|
||||
@ -117,7 +116,7 @@ export const ScreenshotBlur = class ScreenshotBlur {
|
||||
|
||||
set_sigma(s) {
|
||||
this.effects.forEach(effect => {
|
||||
effect.blur_effect.sigma = s * effect.blur_effect;
|
||||
effect.blur_effect.radius = s * 2 * effect.blur_effect;
|
||||
});
|
||||
}
|
||||
|
||||
@ -150,6 +149,7 @@ export const ScreenshotBlur = class ScreenshotBlur {
|
||||
if (actor._blur_actor) {
|
||||
actor.remove_child(actor._blur_actor);
|
||||
actor._blur_actor.destroy();
|
||||
delete actor._blur_actor;
|
||||
}
|
||||
});
|
||||
this.effects = [];
|
||||
|
||||
@ -24,7 +24,7 @@ export const WindowListBlur = class WindowListBlur {
|
||||
// if is window-list
|
||||
this.connections.connect(
|
||||
Main.layoutManager.uiGroup,
|
||||
'actor-added',
|
||||
'child-added',
|
||||
(_, child) => this.try_blur(child)
|
||||
);
|
||||
|
||||
@ -46,9 +46,9 @@ export const WindowListBlur = class WindowListBlur {
|
||||
|
||||
let blur_effect = new Shell.BlurEffect({
|
||||
name: 'window-list-blur',
|
||||
sigma: this.settings.window_list.CUSTOMIZE
|
||||
? this.settings.window_list.SIGMA
|
||||
: this.settings.SIGMA,
|
||||
radius: (this.settings.window_list.CUSTOMIZE
|
||||
? this.settings.window_list.SIGMA
|
||||
: this.settings.SIGMA) * 2,
|
||||
brightness: this.settings.window_list.CUSTOMIZE
|
||||
? this.settings.window_list.BRIGHTNESS
|
||||
: this.settings.BRIGHTNESS,
|
||||
@ -65,7 +65,7 @@ export const WindowListBlur = class WindowListBlur {
|
||||
|
||||
this.connections.connect(
|
||||
child._windowList,
|
||||
'actor-added',
|
||||
'child-added',
|
||||
(_, window) => this.blur_window_button(window)
|
||||
);
|
||||
|
||||
@ -117,7 +117,7 @@ export const WindowListBlur = class WindowListBlur {
|
||||
|
||||
set_sigma(s) {
|
||||
this.effects.forEach(effect => {
|
||||
effect.blur_effect.sigma = s;
|
||||
effect.blur_effect.radius = s * 2;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user