/
index.js
26 lines (23 loc) · 880 Bytes
/
index.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
/**
* @param {import("zerespluginlibrary").Plugin} Plugin
* @param {import("zerespluginlibrary").BoundAPI} Api
*/
module.exports = (Plugin, Api) => {
const {Patcher, WebpackModules} = Api;
const ElectronModule = WebpackModules.getByProps(["setBadge"]);
return class HideIconBadge extends Plugin {
onStart() {
ElectronModule.setBadge(0);
Patcher.before(ElectronModule, "setBadge", (thisObject, methodArguments) => {
methodArguments[0] = 0;
});
ElectronModule.setSystemTrayIcon("DEFAULT");
Patcher.before(ElectronModule, "setSystemTrayIcon", (thisObject, methodArguments) => {
methodArguments[0] === "UNREAD" ? methodArguments[0] = "DEFAULT" : void 0;
});
}
onStop() {
Patcher.unpatchAll();
}
};
};