Make clicking notifications focus ArmCord (#262)

This commit is contained in:
Ven 2022-11-21 06:50:45 +01:00 committed by GitHub
parent ed775cbf31
commit a4968e7529
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,3 +114,19 @@ setInterval(() => {
el.onclick = () => ipcRenderer.send("openSettingsWindow"); el.onclick = () => ipcRenderer.send("openSettingsWindow");
host.append(el); host.append(el);
}, 2000); }, 2000);
// dirty hack to make clicking notifications focus ArmCord
addScript(`
(() => {
const originalSetter = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick").set;
Object.defineProperty(Notification.prototype, "onclick", {
set(onClick) {
originalSetter.call(this, function() {
onClick.apply(this, arguments);
armcord.window.show();
})
},
configurable: true
});
})();
`);