From f781d6a5d135be5cc070c72d95830ef9517eaaae Mon Sep 17 00:00:00 2001 From: Nikolay Bely Date: Wed, 5 Mar 2025 20:22:02 +0700 Subject: [PATCH] ALWAYS_LEAVE_TO_TRAY: Add patch --- patches/0006-Always_leave_to_tray.patch | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 patches/0006-Always_leave_to_tray.patch diff --git a/patches/0006-Always_leave_to_tray.patch b/patches/0006-Always_leave_to_tray.patch new file mode 100644 index 0000000..3f0385d --- /dev/null +++ b/patches/0006-Always_leave_to_tray.patch @@ -0,0 +1,28 @@ +diff --git a/main/lib/preload.js b/main/lib/preload.js +--- a/main/lib/preload.js ++++ b/main/lib/preload.js +@@ -13,2 +13,3 @@ + const vibeAnimationMaxFps = process.env.VIBE_ANIMATION_MAX_FPS ?? 25; ++const alwaysLeaveToTray = process.env.ALWAYS_LEAVE_TO_TRAY && process.env.ALWAYS_LEAVE_TO_TRAY > 0; + electron_1.contextBridge.exposeInMainWorld('VERSION', String(config_js_1.config.buildInfo.VERSION)); +@@ -21,2 +22,3 @@ + electron_1.contextBridge.exposeInMainWorld('VIBE_ANIMATION_MAX_FPS', vibeAnimationMaxFps); ++electron_1.contextBridge.exposeInMainWorld('ALWAYS_LEAVE_TO_TRAY', alwaysLeaveToTray); + electron_1.contextBridge.exposeInMainWorld('desktopEvents', { + + +diff --git a/main/lib/handlers/handleWindowLifecycleEvents.js b/main/lib/handlers/handleWindowLifecycleEvents.js +--- a/main/lib/handlers/handleWindowLifecycleEvents.js ++++ b/main/lib/handlers/handleWindowLifecycleEvents.js +@@ -26,2 +26,3 @@ + const isTrayEnabled = process.env.TRAY_ENABLED && process.env.TRAY_ENABLED > 0; ++ const isAlwaysLeaveToTray = process.env.ALWAYS_LEAVE_TO_TRAY && process.env.ALWAYS_LEAVE_TO_TRAY > 0; + electron_1.app.on('activate', () => { +@@ -56,4 +57,7 @@ const handleWindowLifecycleEvents = (window) => { + window.on('close', (event) => { ++ if (isTrayEnabled && !isAlwaysLeaveToTray && !state_js_1.state.player.isPlaying) { ++ electron_1.app.quit(); ++ } + if (!isTrayEnabled) { + electron_1.app.quit(); + }