mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +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
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
import { t } from "../i18n.mjs";
|
|
|
|
export function registerTray(program) {
|
|
const cmd = program
|
|
.command("tray")
|
|
.description(t("tray.description") || "Control the system tray icon");
|
|
|
|
cmd
|
|
.command("show")
|
|
.description(t("tray.show") || "Show the tray icon (if server is running with --tray)")
|
|
.action(() => {
|
|
process.stderr.write(
|
|
"The tray is managed by `omniroute serve --tray`. Start the server with --tray to enable it.\n"
|
|
);
|
|
});
|
|
|
|
cmd
|
|
.command("hide")
|
|
.description(t("tray.hide") || "Hide the tray icon")
|
|
.action(() => {
|
|
process.stderr.write(
|
|
"Send SIGUSR1 to the serve process to toggle the tray, or restart without --tray.\n"
|
|
);
|
|
});
|
|
|
|
cmd
|
|
.command("quit")
|
|
.description(t("tray.quit") || "Quit OmniRoute via tray")
|
|
.action(async () => {
|
|
const { default: pidUtils } = await import("../utils/pid.mjs").catch(() => ({
|
|
default: null,
|
|
}));
|
|
process.stderr.write("Use `omniroute stop` to stop the server.\n");
|
|
process.exit(0);
|
|
});
|
|
}
|