summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-client
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-05 15:26:25 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-05 15:26:25 +0200
commitbd299df3468822e7b545a90bf55ffbc1bac87f58 (patch)
treec2175e3675355148ae3eb1969983d0fa7a337dac /packages/meshbay-client
parentc11dd22b593358ef7932deec53c8200f5f14ed8b (diff)
downloadmeshbay-bd299df3468822e7b545a90bf55ffbc1bac87f58.tar.gz
feat(client): system tray on Windows, and a clearer tray icon
The tray's Start/Stop already drove nodeService.status/stop/restart, which had full win32 branches for both startup modes from the Node page work -- so enabling it on Windows is widening two platform gates (the `tray` capability in preload.js, the window:minimize-to-tray handler in main.js), not new logic. Replaced the tray icon: the previous white chevron-in-a-box read as an envelope at tray size. New icon is a small "M" drawn as mesh nodes and edges, echoing the app icon's own motif, in the brand blue instead of plain white so it stays legible on both light and dark taskbars/panels. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-client')
-rw-r--r--packages/meshbay-client/src/main.js10
-rw-r--r--packages/meshbay-client/src/preload.js8
-rw-r--r--packages/meshbay-client/src/tray-icon.pngbin504 -> 829 bytes
-rw-r--r--packages/meshbay-client/src/tray-icon@2x.pngbin967 -> 1807 bytes
4 files changed, 10 insertions, 8 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;
diff --git a/packages/meshbay-client/src/preload.js b/packages/meshbay-client/src/preload.js
index 1aa16e5..b390bfb 100644
--- a/packages/meshbay-client/src/preload.js
+++ b/packages/meshbay-client/src/preload.js
@@ -41,10 +41,10 @@ contextBridge.exposeInMainWorld('meshbay', {
localFolders: true,
nativeSave: true,
lanCast: true,
- // Linux only for now -- Windows is being done on that OS. Declared per
- // platform rather than always: a button that hides the window somewhere the
- // desktop shows no indicator would hide it for good.
- tray: process.platform === 'linux',
+ // Linux and Windows have a tray to hide into; declared per platform
+ // rather than always, so the button never appears somewhere the desktop
+ // shows no indicator, which would hide the window for good.
+ tray: process.platform === 'linux' || process.platform === 'win32',
},
// Labels are passed in because the main process has no i18n; see main.js.
diff --git a/packages/meshbay-client/src/tray-icon.png b/packages/meshbay-client/src/tray-icon.png
index 98fd63b..9b54a5d 100644
--- a/packages/meshbay-client/src/tray-icon.png
+++ b/packages/meshbay-client/src/tray-icon.png
Binary files differ
diff --git a/packages/meshbay-client/src/tray-icon@2x.png b/packages/meshbay-client/src/tray-icon@2x.png
index 9cf613d..932a69d 100644
--- a/packages/meshbay-client/src/tray-icon@2x.png
+++ b/packages/meshbay-client/src/tray-icon@2x.png
Binary files differ