diff options
Diffstat (limited to 'packages/meshbay-client/src/main.js')
| -rw-r--r-- | packages/meshbay-client/src/main.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/meshbay-client/src/main.js b/packages/meshbay-client/src/main.js index 273d151..74c8203 100644 --- a/packages/meshbay-client/src/main.js +++ b/packages/meshbay-client/src/main.js @@ -328,12 +328,13 @@ const HUB_FETCH_TIMEOUT_MS = 30000; let mainWindow = null; // ── System tray ────────────────────────────────────────────────────────────── -// Linux only for now; Windows is being done on that OS. +// Linux and Windows. // // The context menu is not optional. Under libappindicator -- which is how GNOME // shows a tray at all, via the AppIndicator extension -- `tray.on('click')` // never fires: the indicator only opens its menu. A tray whose only affordance -// was a click would be inert on the one desktop this targets. +// was a click would be inert there -- Windows does send it, so the same handler +// restores the window on a plain left click. // // Labels arrive from the renderer rather than being translated here. The locale // files are the interface's, the main process has no i18n, and a second string @@ -413,7 +414,7 @@ function ensureTray(labels) { tray = new Tray(path.join(__dirname, 'tray-icon.png')); tray.setToolTip('MeshBay'); refreshTrayMenu(); - // Harmless where it does nothing (GNOME), useful on desktops that do send it. + // No-op on GNOME (never fires there), the left-click restore on Windows. tray.on('click', showFromTray); if (!trayTimer) trayTimer = setInterval(refreshTrayMenu, TRAY_POLL_MS); return tray; @@ -638,7 +639,8 @@ function registerBridge() { // make "minimise to tray" mean "exit". A hidden window keeps the session, the // transfers and the node connection exactly as they were. ipcMain.handle('window:minimize-to-tray', (_e, labels) => { - if (process.platform !== 'linux' || !mainWindow) return false; + const trayOS = process.platform === 'linux' || process.platform === 'win32'; + if (!trayOS || !mainWindow) return false; ensureTray(labels); mainWindow.hide(); return true; |