feat: add a macOS menu bar toggle for desktop

Adds a General settings switch to show or hide the macOS menu bar item.
Persists the new desktopMacMenuBarEnabled setting and passes tray state into Electron.
Disables tray sync and native tray setup when the menu bar is turned off.
This commit is contained in:
Bohdan Triapitsyn
2026-07-22 10:08:58 +03:00
parent 1c82198289
commit 1c7cdf68e3
21 changed files with 116 additions and 15 deletions
+5 -2
View File
@@ -105,6 +105,9 @@ const isTrayPlatform = (): boolean => {
return platform === 'darwin' || platform === 'win32';
};
const isTrayEnabled = (): boolean =>
typeof window !== 'undefined' && window.__OPENCHAMBER_ELECTRON__?.trayEnabled !== false;
const permissionLabel = (request: PermissionRequest): string => {
const head = typeof request.permission === 'string' ? request.permission : 'Permission';
const pattern = Array.isArray(request.patterns) ? request.patterns.find((p) => typeof p === 'string' && p.trim()) : '';
@@ -418,7 +421,7 @@ const buildSnapshot = (instanceName: string): TraySnapshot => {
export const useTraySync = (): void => {
React.useEffect(() => {
if (!isTrayPlatform() || !canUseElectronDesktopIPC()) return;
if (!isTrayPlatform() || !isTrayEnabled() || !canUseElectronDesktopIPC()) return;
let disposed = false;
let lastSerialized = '';
@@ -578,7 +581,7 @@ export const useTraySync = (): void => {
}, []);
React.useEffect(() => {
if (!isTrayPlatform() || typeof window === 'undefined') return;
if (!isTrayPlatform() || !isTrayEnabled() || typeof window === 'undefined') return;
const bridge = (window as unknown as { __OPENCHAMBER_DESKTOP__?: DesktopBridgeGlobal }).__OPENCHAMBER_DESKTOP__;
const listen = bridge?.listen;
if (typeof listen !== 'function') return;