Skip to content

Commit ba09307

Browse files
committed
Updated to match version 16 capabilities
1 parent b47ff2a commit ba09307

18 files changed

+1029
-194
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
/build/
22
/pkg/
3-
*~
3+
*~
4+
.idea/
5+
.ts-for-gir.js
6+
.vscode/
7+
jsconfig.json
8+
@types/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ vm_test: build
2121
cp -r build/* $(SHARED_VM)/blur_my_shell/blur-my-shell@aunetx/
2222

2323

24+
vm_pkg: build_pkg
25+
cp pkg/[email protected] $(SHARED_VM)/blur_my_shell/[email protected]
26+
27+
2428
install: build
2529
rm -rf $(HOME)/.local/share/gnome-shell/extensions/blur-my-shell@aunetx
2630
mkdir -p $(HOME)/.local/share/gnome-shell/extensions/blur-my-shell@aunetx

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22

33
A GNOME Shell extension that adds a blur look to different parts of the GNOME Shell, including the top panel, dash and overview.
44

5-
![Capture d’écran de 2021-04-20 15-00-18](https://user-images.githubusercontent.com/31563930/115416485-1cad1a80-a1f8-11eb-844e-cab11d3b863e.png)
6-
![Capture d’écran de 2021-04-20 15-00-13](https://user-images.githubusercontent.com/31563930/115400536-af928880-a1e9-11eb-8ac2-44dcb7718285.png)
7-
85
[<img src="https://github.com/aunetx/files_utils/raw/master/get_it_on_gnome_extensions.png" height="100">](https://extensions.gnome.org/extension/3193/blur-my-shell/)
96

10-
You can now select which part you want to blur, wether or not you want overview animation and there is an option that reduces a lot the artifacts :)
7+
## Screenshots
118

12-
*Note: this extension contains a lot of bugs. If you find one (that is not already reported), please create an issue!*
9+
*Blurred Overview:*
10+
![Blurred Overview](https://user-images.githubusercontent.com/38633812/116588850-779beb80-a935-11eb-8f2f-81bcd46fe694.png)
11+
*Blurred Top Panel:*
12+
![Blurred Top Panel](https://user-images.githubusercontent.com/38633812/116588885-81bdea00-a935-11eb-9c80-c97716369b7c.png)
1313

1414
## Known bugs
1515

1616
### Note
1717

1818
This extension can be buggy, as the gnome-shell's blur implementation is quite flawed in some ways.
1919

20-
However, selecting *no artifacts* in the settings allows the blur to regenerate itself a lot better, at the expense of CPU time (adds ~3% CPU usage for the gnome-shell process in my old Thinkpad).
20+
To entirely remove artifacts from the top panel, you can use static blur with the appropriate switch, **use static blur**.
21+
22+
Moreover, if you don't use static blur, selecting *no artifacts* in the settings allows the blur to regenerate itself a lot better, at the expense of CPU time (but cannot currently tell the difference, less than 0.5% CPU on my middle-range i5)
2123

22-
Selecting another profile might be enought (especially if you have disabled animations), feel free to test!
24+
Selecting another profile might be enough (especially if you have disabled animations and/or windows borders), feel free to test!
2325

2426
### List of bugs
2527

@@ -44,10 +46,10 @@ And restart GNOME Shell if needed.
4446

4547
### Versions support
4648

47-
The current extension supports those GNOME Shell versions:
49+
The current extension supports these GNOME Shell versions:
4850

49-
- 3.36
5051
- 3.38
52+
- 3.36
5153

5254
## License
5355

src/connections.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ var Connections = class Connections {
4040
this.process_connection(actor, id);
4141
}
4242

43+
disconnect_all_for(actor) {
44+
actor_connections = this.buffer.filter((infos) => {
45+
infos.actor == actor
46+
});
47+
48+
actor_connections.forEach((connection) => {
49+
// disconnect
50+
try {
51+
connection.actor.disconnect(connection.id)
52+
} catch (e) {
53+
this._log(`error removing connection: ${e}; continuing`)
54+
}
55+
56+
// remove from buffer
57+
let index = this.buffer.indexOf(connection);
58+
this.buffer.splice(index, 1);
59+
})
60+
}
61+
4362
disconnect_all() {
4463
this.buffer.forEach((connection) => {
4564
try {

src/dash.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
const St = imports.gi.St;
4-
const Meta = imports.gi.Meta;
5-
const Shell = imports.gi.Shell;
3+
const { St, Shell, Meta } = imports.gi;
64
const Main = imports.ui.main;
75

86
const default_sigma = 30;
@@ -15,9 +13,12 @@ var DashBlur = class DashBlur {
1513

1614
enable() {
1715
this._log("blurring dash");
16+
this.update()
17+
}
1818

19+
update() {
1920
if (Main.overview.dash.constructor.name == "Dash") {
20-
Main.overview.dash.get_child_at_index(0).style = "background-color:rgba(0,0,0,0.0)";
21+
Main.overview.dash.get_child_at_index(0).style = "background-color:rgba(0,0,0," + prefs.DASH_OPACITY.get() + ")";
2122
}
2223
}
2324

@@ -27,12 +28,14 @@ var DashBlur = class DashBlur {
2728
if (Main.overview.dash.constructor.name == "Dash") {
2829
if (!Main.screenShield.locked) {
2930
try {
30-
Main.overview.dash.get_child_at_index(0).style = none;
31+
Main.overview.dash.get_child_at_index(0).style = null;
3132
} catch (e) {
3233
this._log(e)
3334
}
3435
}
3536
}
37+
38+
this.connections.disconnect_all();
3639
}
3740

3841
_log(str) {

src/dash_to_dock.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
const St = imports.gi.St;
4-
const GLib = imports.gi.GLib;
5-
const Shell = imports.gi.Shell;
3+
const { St, Shell, GLib } = imports.gi;
64
const Main = imports.ui.main;
75
const Signals = imports.signals;
86

@@ -192,9 +190,11 @@ var DashBlur = class DashBlur {
192190
disable() {
193191
this._log("removing blur from dashes");
194192

193+
195194
this.emit('remove-dashes', true);
196195

197196
this.dashes = [];
197+
this.connections.disconnect_all();
198198
}
199199

200200
show() {

src/extension.js

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

3-
const St = imports.gi.St;
4-
const Shell = imports.gi.Shell;
3+
const { St, Shell } = imports.gi;
54
const Main = imports.ui.main;
65

76
const Me = imports.misc.extensionUtils.getCurrentExtension();
@@ -16,41 +15,41 @@ const DashToDock = Me.imports.dash_to_dock;
1615
const Lockscreen = Me.imports.lockscreen;
1716

1817
class Extension {
19-
constructor() {
20-
this._connections = new Connections.Connections;
21-
this._prefs = new Settings.Prefs;
22-
23-
this._panel_blur = new Panel.PanelBlur(this._connections);
24-
this._dash_blur = new Dash.DashBlur(this._connections);
25-
this._dash_to_dock_blur = new DashToDock.DashBlur(this._connections);
26-
this._overview_blur = new Overview.OverviewBlur(this._connections);
27-
this._lockscreen_blur = new Lockscreen.LockscreenBlur(this._connections);
28-
}
18+
constructor() { }
2919

3020
enable() {
3121
this._log("enabling extension...");
22+
this._connections = [];
23+
this._prefs = new Settings.Prefs;
24+
25+
this._panel_blur = new Panel.PanelBlur(new Connections.Connections);
26+
this._dash_blur = new Dash.DashBlur(new Connections.Connections);
27+
this._dash_to_dock_blur = new DashToDock.DashBlur(new Connections.Connections);
28+
this._overview_blur = new Overview.OverviewBlur(new Connections.Connections);
29+
this._lockscreen_blur = new Lockscreen.LockscreenBlur(new Connections.Connections);
30+
31+
this._connections.push(this._panel_blur.connections, this._dash_blur.connections,
32+
this._dash_to_dock_blur.connections, this._overview_blur.connections, this._lockscreen_blur.connections);
3233

3334
this._connect_to_settings();
3435

3536
if (this._prefs.BLUR_PANEL.get()) {
36-
this._panel_blur.enable()
37+
this._panel_blur.enable();
3738
}
3839
if (this._prefs.BLUR_DASH.get()) {
3940
this._dash_blur.enable();
4041
this._dash_to_dock_blur.enable();
4142
}
4243
if (this._prefs.BLUR_OVERVIEW.get()) {
43-
this._overview_blur.enable()
44+
this._overview_blur.enable();
4445
}
4546
if (this._prefs.BLUR_LOCKSCREEN.get()) {
46-
this._lockscreen_blur.enable()
47+
this._lockscreen_blur.enable();
4748
}
4849

4950
this._update_sigma();
5051
this._update_brightness();
5152

52-
this._connect_to_overview();
53-
5453
this._log("extension enabled.");
5554
}
5655

@@ -64,17 +63,24 @@ class Extension {
6463
this._lockscreen_blur.disable();
6564

6665
this._disconnect_settings();
67-
this._connections.disconnect_all();
66+
67+
// in theory, this shouldn't be needed if we switch to making modules responsible for disconnecting their own
68+
// signals. For now, I will leave this small bit of code in. Calling disable on all modules has already
69+
// done the same thing
70+
this._connections.forEach((connections) => {
71+
connections.disconnect_all();
72+
})
73+
this._connections = [];
6874

6975
this._log("extension disabled.");
7076
}
7177

7278
_connect_to_settings() {
7379
this._prefs.SIGMA.changed(() => {
74-
this._update_sigma()
80+
this._update_sigma();
7581
});
7682
this._prefs.BRIGHTNESS.changed(() => {
77-
this._update_brightness()
83+
this._update_brightness();
7884
});
7985

8086
this._prefs.BLUR_DASH.changed(() => {
@@ -88,25 +94,31 @@ class Extension {
8894
});
8995
this._prefs.BLUR_PANEL.changed(() => {
9096
if (this._prefs.BLUR_PANEL.get()) {
91-
this._panel_blur.enable()
97+
this._panel_blur.enable();
9298
} else {
93-
this._panel_blur.disable()
99+
this._panel_blur.disable();
94100
}
95101
});
96102
this._prefs.BLUR_OVERVIEW.changed(() => {
97103
if (this._prefs.BLUR_OVERVIEW.get()) {
98-
this._overview_blur.enable()
104+
this._overview_blur.enable();
99105
} else {
100-
this._overview_blur.disable()
106+
this._overview_blur.disable();
101107
}
102108
});
103109
this._prefs.BLUR_LOCKSCREEN.changed(() => {
104110
if (this._prefs.BLUR_LOCKSCREEN.get()) {
105-
this._lockscreen_blur.enable()
111+
this._lockscreen_blur.enable();
106112
} else {
107-
this._lockscreen_blur.disable()
113+
this._lockscreen_blur.disable();
108114
}
109115
});
116+
this._prefs.DASH_OPACITY.changed(() => {
117+
this._dash_blur.update();
118+
});
119+
this._prefs.STATIC_BLUR.changed(() => {
120+
this._panel_blur.change_blur_type()
121+
});
110122
}
111123

112124
_disconnect_settings() {
@@ -132,24 +144,13 @@ class Extension {
132144
this._lockscreen_blur.set_brightness(brightness);
133145
}
134146

135-
_connect_to_overview() {
136-
this._connections.connect(Main.overview, 'showing', () => {
137-
this._panel_blur.hide();
138-
this._dash_to_dock_blur.hide();
139-
});
140-
this._connections.connect(Main.overview, 'hidden', () => {
141-
this._panel_blur.show();
142-
this._dash_to_dock_blur.show();
143-
});
144-
}
145-
146147
_log(str) {
147148
log(`[Blur my Shell] ${str}`)
148149
}
149-
};
150+
}
150151

151152

152153
// Called on gnome-shell loading, even if extension is deactivated
153154
function init() {
154155
return new Extension();
155-
}
156+
}

src/lockscreen.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict';
22

3-
const St = imports.gi.St;
4-
const Shell = imports.gi.Shell;
3+
const { St, Shell } = imports.gi;
54
const Main = imports.ui.main;
65
const Background = imports.ui.background;
76

8-
const themeContext = St.ThemeContext.get_for_stage(global.stage);
9-
107
let shell_version = imports.misc.config.PACKAGE_VERSION.split('.');
118

129
function verify_function_to_use() {
@@ -49,7 +46,7 @@ var LockscreenBlur = class LockscreenBlur {
4946
for (const widget of this._backgroundGroup.get_children()) {
5047
widget.get_effect('blur').set({
5148
brightness: brightness,
52-
sigma: sigma * themeContext.scale_factor,
49+
sigma: sigma,
5350
});
5451
}
5552
}
@@ -76,12 +73,12 @@ var LockscreenBlur = class LockscreenBlur {
7673

7774
let effect = new Shell.BlurEffect({
7875
brightness: brightness,
79-
sigma: sigma * themeContext.scale_factor,
76+
sigma: sigma,
8077
mode: 0
8178
});
8279

8380
this._scaleChangedId = themeContext.connect('notify::scale-factor', () => {
84-
effect.sigma = sigma * themeContext.scale_factor;
81+
effect.sigma = sigma;
8582
});
8683

8784
widget.add_effect(effect);
@@ -105,6 +102,7 @@ var LockscreenBlur = class LockscreenBlur {
105102
else
106103
imports.ui.unlockDialog.UnlockDialog.prototype._createBackground = original_createBackground_old;
107104

105+
this.connections.disconnect_all();
108106
}
109107

110108
_log(str) {

0 commit comments

Comments
 (0)