Tray: Add left click hide/show feature (#404)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
6ed59332d1
commit
8c6941b8e9
3 changed files with 12 additions and 2 deletions
|
@ -73,6 +73,10 @@ const [addSettingsListener, removeSettingsListeners] = makeSettingsListenerHelpe
|
||||||
const [addVencordSettingsListener, removeVencordSettingsListeners] = makeSettingsListenerHelpers(VencordSettings);
|
const [addVencordSettingsListener, removeVencordSettingsListeners] = makeSettingsListenerHelpers(VencordSettings);
|
||||||
|
|
||||||
function initTray(win: BrowserWindow) {
|
function initTray(win: BrowserWindow) {
|
||||||
|
const onTrayClick = () => {
|
||||||
|
if (Settings.store.clickTrayToShowHide && win.isVisible()) win.hide();
|
||||||
|
else win.show();
|
||||||
|
};
|
||||||
const trayMenu = Menu.buildFromTemplate([
|
const trayMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: "Open",
|
label: "Open",
|
||||||
|
@ -120,7 +124,7 @@ function initTray(win: BrowserWindow) {
|
||||||
tray = new Tray(ICON_PATH);
|
tray = new Tray(ICON_PATH);
|
||||||
tray.setToolTip("Vesktop");
|
tray.setToolTip("Vesktop");
|
||||||
tray.setContextMenu(trayMenu);
|
tray.setContextMenu(trayMenu);
|
||||||
tray.on("click", () => win.show());
|
tray.on("click", onTrayClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearData(win: BrowserWindow) {
|
async function clearData(win: BrowserWindow) {
|
||||||
|
|
|
@ -83,6 +83,12 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
|
||||||
invisible: () => isMac,
|
invisible: () => isMac,
|
||||||
disabled: () => Settings.store.tray === false
|
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",
|
key: "disableMinSize",
|
||||||
title: "Disable minimum window size",
|
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;
|
arRPC?: boolean;
|
||||||
appBadge?: boolean;
|
appBadge?: boolean;
|
||||||
disableMinSize?: boolean;
|
disableMinSize?: boolean;
|
||||||
|
clickTrayToShowHide?: boolean;
|
||||||
/** @deprecated use customTitleBar */
|
/** @deprecated use customTitleBar */
|
||||||
discordWindowsTitleBar?: boolean;
|
discordWindowsTitleBar?: boolean;
|
||||||
customTitleBar?: boolean;
|
customTitleBar?: boolean;
|
||||||
|
|
Loading…
Reference in a new issue