diff --git a/app/main.js b/app/main.js index 4028136..7b187e9 100644 --- a/app/main.js +++ b/app/main.js @@ -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(); }); diff --git a/assets/icons/apps/excel.png b/assets/icons/apps/excel.png new file mode 100644 index 0000000..f872787 Binary files /dev/null and b/assets/icons/apps/excel.png differ diff --git a/assets/icons/apps/onedrive.png b/assets/icons/apps/onedrive.png new file mode 100644 index 0000000..40c54c2 Binary files /dev/null and b/assets/icons/apps/onedrive.png differ diff --git a/assets/icons/apps/onenote.png b/assets/icons/apps/onenote.png new file mode 100644 index 0000000..92f31e0 Binary files /dev/null and b/assets/icons/apps/onenote.png differ diff --git a/assets/icons/apps/outlook.png b/assets/icons/apps/outlook.png new file mode 100644 index 0000000..bb297ff Binary files /dev/null and b/assets/icons/apps/outlook.png differ diff --git a/assets/icons/apps/powerpoint.png b/assets/icons/apps/powerpoint.png new file mode 100644 index 0000000..8b3c29e Binary files /dev/null and b/assets/icons/apps/powerpoint.png differ diff --git a/assets/icons/apps/teams.png b/assets/icons/apps/teams.png new file mode 100644 index 0000000..5cefc6f Binary files /dev/null and b/assets/icons/apps/teams.png differ diff --git a/assets/icons/apps/word.png b/assets/icons/apps/word.png new file mode 100644 index 0000000..a60c86a Binary files /dev/null and b/assets/icons/apps/word.png differ