Change icons according to the website opened

- macOS Only for now
This commit is contained in:
Agampreet Singh
2023-06-09 22:37:07 +05:30
parent 924183dc84
commit 2997e82cad
8 changed files with 80 additions and 0 deletions

View File

@@ -154,12 +154,92 @@ app.on("web-contents-created", (event, contents) => {
return { action: "allow" };
}
});
contents.on("did-finish-load", () => {
try {
if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Microsoft PowerPoint")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/powerpoint.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Microsoft Word")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/word.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Microsoft Excel")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/excel.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Outlook")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/outlook.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("OneDrive")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/onedrive.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Microsoft Teams")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/teams.png")
);
}
} else if (
BrowserWindow.getFocusedWindow()
.webContents.getTitle()
.includes("Microsoft OneNote Online")
) {
if (process.platform === "darwin") {
app.dock.setIcon(
path.join(__dirname, "../assets/icons/apps/onenote.png")
);
}
} else {
app.dock.setIcon(null);
}
} catch {}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
if (process.platform === "darwin") {
app.dock.setIcon(null);
}
clearActivity();
});

BIN
assets/icons/apps/excel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
assets/icons/apps/teams.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

BIN
assets/icons/apps/word.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB