Change icons according to the website opened
- macOS Only for now
80
app/main.js
@@ -154,12 +154,92 @@ app.on("web-contents-created", (event, contents) => {
|
|||||||
return { action: "allow" };
|
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", () => {
|
app.on("window-all-closed", () => {
|
||||||
if (process.platform !== "darwin") {
|
if (process.platform !== "darwin") {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
app.dock.setIcon(null);
|
||||||
|
}
|
||||||
clearActivity();
|
clearActivity();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
BIN
assets/icons/apps/excel.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
BIN
assets/icons/apps/onedrive.png
Normal file
|
After Width: | Height: | Size: 208 KiB |
BIN
assets/icons/apps/onenote.png
Normal file
|
After Width: | Height: | Size: 203 KiB |
BIN
assets/icons/apps/outlook.png
Normal file
|
After Width: | Height: | Size: 218 KiB |
BIN
assets/icons/apps/powerpoint.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
assets/icons/apps/teams.png
Normal file
|
After Width: | Height: | Size: 215 KiB |
BIN
assets/icons/apps/word.png
Normal file
|
After Width: | Height: | Size: 208 KiB |