diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index 1479b8a0..7e0afdef 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -73,6 +73,10 @@ const [addSettingsListener, removeSettingsListeners] = makeSettingsListenerHelpe const [addVencordSettingsListener, removeVencordSettingsListeners] = makeSettingsListenerHelpers(VencordSettings); function initTray(win: BrowserWindow) { + const onTrayClick = () => { + if (Settings.store.clickTrayToShowHide && win.isVisible()) win.hide(); + else win.show(); + }; const trayMenu = Menu.buildFromTemplate([ { label: "Open", @@ -120,7 +124,7 @@ function initTray(win: BrowserWindow) { tray = new Tray(ICON_PATH); tray.setToolTip("Vesktop"); tray.setContextMenu(trayMenu); - tray.on("click", () => win.show()); + tray.on("click", onTrayClick); } async function clearData(win: BrowserWindow) { diff --git a/src/renderer/components/settings/Settings.tsx b/src/renderer/components/settings/Settings.tsx index cc6b3c2e..d6de13c4 100644 --- a/src/renderer/components/settings/Settings.tsx +++ b/src/renderer/components/settings/Settings.tsx @@ -83,6 +83,12 @@ const SettingsOptions: Record> invisible: () => isMac, disabled: () => Settings.store.tray === false }, + { + key: "clickTrayToShowHide", + title: "Hide/Show on tray click", + description: "Left clicking tray icon will toggle the vesktop window visibility.", + defaultValue: false + }, { key: "disableMinSize", title: "Disable minimum window size", diff --git a/src/shared/settings.d.ts b/src/shared/settings.d.ts index d796e4be..7f6e74a5 100644 --- a/src/shared/settings.d.ts +++ b/src/shared/settings.d.ts @@ -20,7 +20,7 @@ export interface Settings { arRPC?: boolean; appBadge?: boolean; disableMinSize?: boolean; - + clickTrayToShowHide?: boolean; /** @deprecated use customTitleBar */ discordWindowsTitleBar?: boolean; customTitleBar?: boolean;