Add left click hide/show feature
This commit adds the option to click on the tray to hide or show the window, it is optional and is disabled by default.
This commit is contained in:
parent
612d35c96f
commit
f4f268a7ef
3 changed files with 15 additions and 2 deletions
|
@ -73,6 +73,13 @@ const [addSettingsListener, removeSettingsListeners] = makeSettingsListenerHelpe
|
|||
const [addVencordSettingsListener, removeVencordSettingsListeners] = makeSettingsListenerHelpers(VencordSettings);
|
||||
|
||||
function initTray(win: BrowserWindow) {
|
||||
const trayClickHandler = Settings.store.clickTrayToShowHide
|
||||
? () => {
|
||||
win.isVisible() ? win.hide() : win.show();
|
||||
}
|
||||
: () => {
|
||||
win.show();
|
||||
};
|
||||
const trayMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: "Open",
|
||||
|
@ -120,7 +127,7 @@ function initTray(win: BrowserWindow) {
|
|||
tray = new Tray(ICON_PATH);
|
||||
tray.setToolTip("Vesktop");
|
||||
tray.setContextMenu(trayMenu);
|
||||
tray.on("click", () => win.show());
|
||||
tray.on("click", trayClickHandler);
|
||||
}
|
||||
|
||||
async function clearData(win: BrowserWindow) {
|
||||
|
|
|
@ -83,6 +83,12 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
|
|||
invisible: () => isMac,
|
||||
disabled: () => Settings.store.tray === false
|
||||
},
|
||||
{
|
||||
key: "clickTrayToShowHide",
|
||||
title: "Hide/Show on tray left click",
|
||||
description: "Left clicking on tray will hide or show the vesktop window. Requires a full restart.",
|
||||
defaultValue: false
|
||||
},
|
||||
{
|
||||
key: "disableMinSize",
|
||||
title: "Disable minimum window size",
|
||||
|
|
2
src/shared/settings.d.ts
vendored
2
src/shared/settings.d.ts
vendored
|
@ -20,7 +20,7 @@ export interface Settings {
|
|||
arRPC?: boolean;
|
||||
appBadge?: boolean;
|
||||
disableMinSize?: boolean;
|
||||
|
||||
clickTrayToShowHide?: boolean;
|
||||
/** @deprecated use customTitleBar */
|
||||
discordWindowsTitleBar?: boolean;
|
||||
customTitleBar?: boolean;
|
||||
|
|
Reference in a new issue