From d07d6d14ed7a71196362f1b7bc8d60e98bfbea8c Mon Sep 17 00:00:00 2001 From: Penny Date: Mon, 8 Jul 2024 14:43:26 -0400 Subject: [PATCH 1/2] Add option to not close to tray --- src/utils/Tray.ts | 4 ++++ src/utils/Window.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/utils/Tray.ts b/src/utils/Tray.ts index 56e8d76..1498e27 100644 --- a/src/utils/Tray.ts +++ b/src/utils/Tray.ts @@ -37,6 +37,10 @@ export async function init(app: Electron.App, client: import('discord-rpc').Clie label: 'Only show RPC if music is playing', type: 'checkbox', checked: Config.get(app, 'only_show_if_playing'), click: (menuItem) => Config.set(app, 'only_show_if_playing', menuItem.checked) }, + { + label: 'Don\'t close to try', type: 'checkbox', checked: Config.get(app, 'dont_close_to_tray'), + click: (menuItem) => Config.set(app, 'dont_close_to_tray', menuItem.checked) + }, { id: 'reconnect', label: Config.get(app, 'use_listening_to') ? 'Reconnect to WebSocket' : 'Reconnect RPC', diff --git a/src/utils/Window.ts b/src/utils/Window.ts index cd0b692..4f252bf 100644 --- a/src/utils/Window.ts +++ b/src/utils/Window.ts @@ -84,6 +84,9 @@ export async function load(app: Electron.App) { }); win.on('close', (e) => { + if (Config.get(app, 'dont_close_to_tray')) { + return true; + } e.preventDefault(); win.hide(); From c71822d460fe4fd16fbe88feb6ec383090fe00aa Mon Sep 17 00:00:00 2001 From: Penny Date: Tue, 9 Jul 2024 12:50:33 -0400 Subject: [PATCH 2/2] typo --- src/utils/Tray.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/Tray.ts b/src/utils/Tray.ts index 1498e27..8b9a29e 100644 --- a/src/utils/Tray.ts +++ b/src/utils/Tray.ts @@ -38,7 +38,7 @@ export async function init(app: Electron.App, client: import('discord-rpc').Clie click: (menuItem) => Config.set(app, 'only_show_if_playing', menuItem.checked) }, { - label: 'Don\'t close to try', type: 'checkbox', checked: Config.get(app, 'dont_close_to_tray'), + label: 'Don\'t close to tray', type: 'checkbox', checked: Config.get(app, 'dont_close_to_tray'), click: (menuItem) => Config.set(app, 'dont_close_to_tray', menuItem.checked) }, {