-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.js
More file actions
44 lines (36 loc) · 1.36 KB
/
Copy pathextension.js
File metadata and controls
44 lines (36 loc) · 1.36 KB
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 { Extension } from "resource:///org/gnome/shell/extensions/extension.js";
import { UnlockDialog } from "resource:///org/gnome/shell/ui/unlockDialog.js";
export default class DisableLockScreenMediaExtension extends Extension {
enable() {
const proto = UnlockDialog.prototype;
// Save original _init in a closure
const originalInit = proto._init;
this._originalInit = originalInit;
proto._init = function (...args) {
// Call the original _init
originalInit.apply(this, args);
// Patch the notifications box instance
const nb = this._notificationsBox;
if (nb) {
if (nb._mediaSource) {
nb._mediaSource.disconnectObject(nb);
nb._mediaSource = null;
}
if (nb._players) {
for (const player of nb._players.keys()) {
nb._removePlayer(player);
}
nb._players.clear();
}
nb._addPlayer = function () {}; // block future additions
}
};
}
disable() {
if (this._originalInit) {
// Restore the original UnlockDialog._init
UnlockDialog.prototype._init = this._originalInit;
this._originalInit = null;
}
}
}