mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 04:42:10 +03:00
- bin/cli/tray/index.mjs: initTray/killTray/isTrayActive/isTraySupported - bin/cli/tray/traySystray.mjs: systray2 para macOS/Linux (graceful fallback) - bin/cli/tray/trayWindows.mjs: PowerShell NotifyIcon (sem binário extra) - bin/cli/tray/autostart.mjs: launchd (macOS), reg (Windows), .desktop (Linux) - bin/cli/commands/tray.mjs: subcomandos show/hide/quit - bin/cli/commands/autostart.mjs: subcomandos enable/disable/status - serve.mjs: flags --tray/--no-tray, integração após servidor iniciar - i18n: chaves tray.*, autostart.*, serve.tray/no_tray em en.json e pt-BR.json - check-env-doc-sync: DISPLAY e WAYLAND_DISPLAY adicionados ao allowlist (sinais do host OS) - 8 testes unitários cobrindo autostart por plataforma e importação dos módulos
27 lines
723 B
JavaScript
27 lines
723 B
JavaScript
import { isTraySupported, initSystrayUnix, killSystrayUnix } from "./traySystray.mjs";
|
|
import { initWinTray, killWinTray } from "./trayWindows.mjs";
|
|
|
|
let active = null;
|
|
|
|
export { isTraySupported };
|
|
|
|
export function initTray({ port, onQuit, onOpenDashboard, onShowLogs }) {
|
|
if (!isTraySupported()) return null;
|
|
const ctx = { port, onQuit, onOpenDashboard, onShowLogs };
|
|
active = process.platform === "win32" ? initWinTray(ctx) : initSystrayUnix(ctx);
|
|
return active;
|
|
}
|
|
|
|
export function killTray() {
|
|
if (!active) return;
|
|
try {
|
|
if (process.platform === "win32") killWinTray(active);
|
|
else killSystrayUnix(active);
|
|
} catch {}
|
|
active = null;
|
|
}
|
|
|
|
export function isTrayActive() {
|
|
return active !== null;
|
|
}
|