-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
43 lines (36 loc) · 1.07 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Clutter from 'gi://Clutter';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
export default class Extension {
constructor() {
}
enable() {
this._child_added_signal_id = Main.panel._rightBox.connect(
'child-added', this._child_added_event_handler
)
this._add_effects();
}
disable() {
Main.panel._rightBox.disconnect(this._child_added_signal_id);
this._remove_effects();
}
_child_added_event_handler(_, child) {
child.add_effect(new Clutter.DesaturateEffect());
}
_get_tray() {
return Main.panel._rightBox.get_children();
}
_add_effects() {
for (let child of this._get_tray()) {
child.add_effect(new Clutter.DesaturateEffect());
}
}
_remove_effects() {
for (let child of this._get_tray()) {
for (let effect of child.get_effects()) {
if (effect instanceof Clutter.DesaturateEffect) {
child.remove_effect(effect);
}
}
}
}
}