From 775ad3064344c94df8d4e180e229b80285ba8e95 Mon Sep 17 00:00:00 2001 From: Oleh Polisan Date: Wed, 19 Jun 2024 15:53:56 +0300 Subject: [PATCH] feat: ability to disable icons rewriting --- src/main/mainWindow.ts | 5 +---- src/renderer/components/settings/Settings.tsx | 13 ++++++++++--- src/renderer/components/settings/TraySettings.tsx | 4 ++-- src/shared/settings.d.ts | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index e1b9e15..d752f89 100755 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -531,10 +531,7 @@ export async function createTrayIcon(iconName: string, iconDataURL: string) { export async function generateTrayIcons() { // this function generates tray icons as .png's in Vesktop cache for future use mkdirSync(join(DATA_DIR, "TrayIcons"), { recursive: true }); - const trayIconsColor = Settings.store.trayColor ?? "#3DB77F"; - const userDefinedIcons = false; - if (userDefinedIcons) { - } else { + if (!Settings.store.trayCustom) { const Icons = ["speaking", "muted", "deafened", "idle"]; for (const icon of Icons) { mainWin.webContents.send(IpcEvents.CREATE_TRAY_ICON_REQUEST, icon); diff --git a/src/renderer/components/settings/Settings.tsx b/src/renderer/components/settings/Settings.tsx index 3e3b9e9..e394dd5 100644 --- a/src/renderer/components/settings/Settings.tsx +++ b/src/renderer/components/settings/Settings.tsx @@ -70,6 +70,13 @@ const SettingsOptions: Record> ], Behaviour: [ TraySwitch, + { + key: "trayCustom", + title: "Use custom tray icons", + description: "Disable rewriting tray icons at config folder", + defaultValue: false, + invisible: () => Settings.store.tray === false + }, TrayIconPicker, TrayFillColorSwitch, { @@ -77,14 +84,14 @@ const SettingsOptions: Record> title: "Minimize to tray", description: "Hitting X will make Vesktop minimize to the tray instead of closing", defaultValue: true, - invisible: () => isMac, - disabled: () => Settings.store.tray === false + invisible: () => isMac || 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 + defaultValue: false, + invisible: () => Settings.store.tray === false }, { key: "disableMinSize", diff --git a/src/renderer/components/settings/TraySettings.tsx b/src/renderer/components/settings/TraySettings.tsx index 5d501fc..a0b5152 100644 --- a/src/renderer/components/settings/TraySettings.tsx +++ b/src/renderer/components/settings/TraySettings.tsx @@ -50,7 +50,7 @@ export const TraySwitch: SettingsComponent = ({ settings }) => { }; export const TrayIconPicker: SettingsComponent = ({ settings }) => { - if (!settings.tray) return null; + if (!settings.tray || settings.trayCustom) return null; return (
@@ -75,7 +75,7 @@ export const TrayIconPicker: SettingsComponent = ({ settings }) => { }; export const TrayFillColorSwitch: SettingsComponent = ({ settings }) => { - if (!settings.tray) return null; + if (!settings.tray || settings.trayCustom) return null; return (
diff --git a/src/shared/settings.d.ts b/src/shared/settings.d.ts index 3288a01..6e43722 100644 --- a/src/shared/settings.d.ts +++ b/src/shared/settings.d.ts @@ -13,6 +13,7 @@ export interface Settings { tray?: boolean; trayColor?: string; trayAutoFill?: "auto" | "white" | "black"; + trayCustom?: boolean; minimizeToTray?: boolean; openLinksWithElectron?: boolean; staticTitle?: boolean;