aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/platform.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/platform.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/platform.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/platform.js b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
index 8f5d484..b009ebe 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/platform.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
@@ -48,6 +48,10 @@ export const capabilities = {
nativeSave: Boolean(bridge && bridge.capabilities && bridge.capabilities.nativeSave),
// Cast decrypted video to a device on the same LAN via a local HTTP relay.
lanCast: Boolean(bridge && bridge.capabilities && bridge.capabilities.lanCast),
+ // Hide the window to a system tray indicator. Declared per-OS by the app, not
+ // by this file: a tray is only worth offering where the desktop actually shows
+ // one, so the browser and any platform without support simply never see it.
+ tray: Boolean(bridge && bridge.capabilities && bridge.capabilities.tray),
};
/**
@@ -454,9 +458,21 @@ export const cast = {
},
};
+/**
+ * Hide the window to the system tray indicator.
+ *
+ * A no-op without the bridge, so the same nav renders in a browser without a
+ * guard at the call site -- though `capabilities.tray` keeps the button itself
+ * out of a browser, where there is no tray to minimise into.
+ */
+export async function minimizeToTray(labels) {
+ if (!bridge || !bridge.minimizeToTray) return false;
+ return bridge.minimizeToTray(labels);
+}
+
export default { isNative, hubBase, capabilities, secrets, nativeSave,
apiFetch, device, bridgeMessage, folder, rootPicker, node,
- cast };
+ cast, minimizeToTray };
// Also a global, because `transport.js` is loaded as a classic script — it
// predates the module graph and exposes `MeshBayTransport` the same way. The
@@ -466,5 +482,5 @@ if (typeof window !== 'undefined') {
window.MeshBayPlatform = { isNative, hubBase, capabilities, secrets,
nativeSave, apiFetch, device,
bridgeMessage, folder, rootPicker, node,
- cast };
+ cast, minimizeToTray };
}