diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 167e6822..a428a7cb 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -21,7 +21,7 @@ import { isTruthy } from "shared/utils/guards"; import { once } from "shared/utils/once"; import type { SettingsStore } from "shared/utils/SettingsStore"; -import { DEAFENED_ICON_PATH, ICON_PATH, IDLE_ICON_PATH, MUTED_ICON_PATH, SPEAKING_ICON_PATH } from "../shared/paths"; +import { DEAFENED_ICON_PATH, ICON_PATH, IDLE_ICON_PATH, MUTED_ICON_PATH, SPEAKING_ICON_PATH, UNREAD_ICON_PATH } from "shared/paths"; import { createAboutWindow } from "./about"; import { initArRPC } from "./arrpc"; import { @@ -491,6 +491,9 @@ export async function setTrayIcon(iconName) { case "deafened": tray.setImage(DEAFENED_ICON_PATH); break; + case "unread": + tray.setImage(UNREAD_ICON_PATH); + break; case "idle": tray.setImage(IDLE_ICON_PATH); break; diff --git a/src/renderer/appBadge.ts b/src/renderer/appBadge.ts index b55d488b..0ca10b22 100644 --- a/src/renderer/appBadge.ts +++ b/src/renderer/appBadge.ts @@ -8,6 +8,7 @@ import { filters, waitFor } from "@vencord/types/webpack"; import { RelationshipStore } from "@vencord/types/webpack/common"; import { Settings } from "./settings"; +import { isInVC } from "./patches/tray"; let GuildReadStateStore: any; let NotificationSettingsStore: any; @@ -23,8 +24,12 @@ export function setBadge() { let totalCount = mentionCount + pendingRequests; if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1; - VesktopNative.app.setBadgeCount(totalCount); + if(totalCount > 0 && !isInVC) { + VesktopNative.app.setTrayIcon("unread"); + } else if (!isInVC) { + VesktopNative.app.setTrayIcon("main"); + } } catch (e) { console.error(e); } diff --git a/src/renderer/patches/tray.ts b/src/renderer/patches/tray.ts index 3288d6ac..9bec183d 100644 --- a/src/renderer/patches/tray.ts +++ b/src/renderer/patches/tray.ts @@ -10,6 +10,8 @@ import { FluxDispatcher, UserStore } from "@vencord/types/webpack/common"; const muteActions = findByPropsLazy("isSelfMute"); const deafActions = findByPropsLazy("isSelfDeaf"); +export var isInVC = false; + onceReady.then(() => { const userID = UserStore.getCurrentUser().id; @@ -49,6 +51,7 @@ onceReady.then(() => { FluxDispatcher.subscribe("RTC_CONNECTION_STATE", params => { if (params.state === "RTC_CONNECTED") { + isInVC = true; if (deafActions.isSelfDeaf()) { VesktopNative.app.setTrayIcon("deafened"); } else if (muteActions.isSelfMute()) { @@ -57,6 +60,7 @@ onceReady.then(() => { VesktopNative.app.setTrayIcon("idle"); } } else if (params.state === "RTC_DISCONNECTED") { + isInVC = false; VesktopNative.app.setTrayIcon("main"); } }); diff --git a/src/shared/paths.ts b/src/shared/paths.ts index 8ef13902..30cd23b8 100644 --- a/src/shared/paths.ts +++ b/src/shared/paths.ts @@ -14,3 +14,4 @@ export const SPEAKING_ICON_PATH = /* @__PURE__ */ join(STATIC_DIR, "speaking.png export const MUTED_ICON_PATH = /* @__PURE__ */ join(STATIC_DIR, "muted.png"); export const DEAFENED_ICON_PATH = /* @__PURE__ */ join(STATIC_DIR, "deafened.png"); export const IDLE_ICON_PATH = /* @__PURE__ */ join(STATIC_DIR, "idle.png"); +export const UNREAD_ICON_PATH = /* @__PURE__ */ join(STATIC_DIR, "unread.png"); diff --git a/static/unread.png b/static/unread.png new file mode 100644 index 00000000..4bffa98b Binary files /dev/null and b/static/unread.png differ