feat: ability to disable icons rewriting

This commit is contained in:
Oleh Polisan 2024-06-19 15:53:56 +03:00
parent e899b16b21
commit 775ad30643
4 changed files with 14 additions and 9 deletions

View file

@ -531,10 +531,7 @@ export async function createTrayIcon(iconName: string, iconDataURL: string) {
export async function generateTrayIcons() { export async function generateTrayIcons() {
// this function generates tray icons as .png's in Vesktop cache for future use // this function generates tray icons as .png's in Vesktop cache for future use
mkdirSync(join(DATA_DIR, "TrayIcons"), { recursive: true }); mkdirSync(join(DATA_DIR, "TrayIcons"), { recursive: true });
const trayIconsColor = Settings.store.trayColor ?? "#3DB77F"; if (!Settings.store.trayCustom) {
const userDefinedIcons = false;
if (userDefinedIcons) {
} else {
const Icons = ["speaking", "muted", "deafened", "idle"]; const Icons = ["speaking", "muted", "deafened", "idle"];
for (const icon of Icons) { for (const icon of Icons) {
mainWin.webContents.send(IpcEvents.CREATE_TRAY_ICON_REQUEST, icon); mainWin.webContents.send(IpcEvents.CREATE_TRAY_ICON_REQUEST, icon);

View file

@ -70,6 +70,13 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
], ],
Behaviour: [ Behaviour: [
TraySwitch, TraySwitch,
{
key: "trayCustom",
title: "Use custom tray icons",
description: "Disable rewriting tray icons at config folder",
defaultValue: false,
invisible: () => Settings.store.tray === false
},
TrayIconPicker, TrayIconPicker,
TrayFillColorSwitch, TrayFillColorSwitch,
{ {
@ -77,14 +84,14 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
title: "Minimize to tray", title: "Minimize to tray",
description: "Hitting X will make Vesktop minimize to the tray instead of closing", description: "Hitting X will make Vesktop minimize to the tray instead of closing",
defaultValue: true, defaultValue: true,
invisible: () => isMac, invisible: () => isMac || Settings.store.tray === false
disabled: () => Settings.store.tray === false
}, },
{ {
key: "clickTrayToShowHide", key: "clickTrayToShowHide",
title: "Hide/Show on tray click", title: "Hide/Show on tray click",
description: "Left clicking tray icon will toggle the vesktop window visibility.", description: "Left clicking tray icon will toggle the vesktop window visibility.",
defaultValue: false defaultValue: false,
invisible: () => Settings.store.tray === false
}, },
{ {
key: "disableMinSize", key: "disableMinSize",

View file

@ -50,7 +50,7 @@ export const TraySwitch: SettingsComponent = ({ settings }) => {
}; };
export const TrayIconPicker: SettingsComponent = ({ settings }) => { export const TrayIconPicker: SettingsComponent = ({ settings }) => {
if (!settings.tray) return null; if (!settings.tray || settings.trayCustom) return null;
return ( return (
<div className="vcd-tray-settings"> <div className="vcd-tray-settings">
<div className="vcd-tray-container"> <div className="vcd-tray-container">
@ -75,7 +75,7 @@ export const TrayIconPicker: SettingsComponent = ({ settings }) => {
}; };
export const TrayFillColorSwitch: SettingsComponent = ({ settings }) => { export const TrayFillColorSwitch: SettingsComponent = ({ settings }) => {
if (!settings.tray) return null; if (!settings.tray || settings.trayCustom) return null;
return ( return (
<div className="vcd-tray-settings"> <div className="vcd-tray-settings">
<div className="vcd-tray-container"> <div className="vcd-tray-container">

View file

@ -13,6 +13,7 @@ export interface Settings {
tray?: boolean; tray?: boolean;
trayColor?: string; trayColor?: string;
trayAutoFill?: "auto" | "white" | "black"; trayAutoFill?: "auto" | "white" | "black";
trayCustom?: boolean;
minimizeToTray?: boolean; minimizeToTray?: boolean;
openLinksWithElectron?: boolean; openLinksWithElectron?: boolean;
staticTitle?: boolean; staticTitle?: boolean;