Update Discord RPC whenever a new window is created

This commit is contained in:
Agampreet Singh
2023-06-10 01:24:26 +05:30
parent 2a0b175c78
commit 5a70499ad0

View File

@@ -245,6 +245,11 @@ app.on("web-contents-created", (event, contents) => {
});
app.on("browser-window-created", (event, window) => {
window.webContents.on("did-finish-load", () => {
if (store.get("discordrpcstatus") === "true") {
setActivity(`On "${window.webContents.getTitle()}"`);
}
});
if (store.get("blockads") === "true") {
ElectronBlocker.fromPrebuiltAdsOnly(fetch).then((blocker) => {
blocker.enableBlockingInSession(window.webContents.session);