mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-08 00:02:20 +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
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { t } from "../i18n.mjs";
|
|
import { emit } from "../output.mjs";
|
|
|
|
export function registerAutostart(program) {
|
|
const cmd = program
|
|
.command("autostart")
|
|
.description(t("autostart.description") || "Manage OmniRoute autostart at login");
|
|
|
|
cmd
|
|
.command("enable")
|
|
.description(t("autostart.enable") || "Enable autostart at login")
|
|
.action(async (opts, c) => {
|
|
const globalOpts = c.optsWithGlobals();
|
|
const { enable } = await import("../tray/autostart.mjs");
|
|
const ok = enable();
|
|
emit({ enabled: ok }, globalOpts);
|
|
if (!ok) process.exit(1);
|
|
});
|
|
|
|
cmd
|
|
.command("disable")
|
|
.description(t("autostart.disable") || "Disable autostart at login")
|
|
.action(async (opts, c) => {
|
|
const globalOpts = c.optsWithGlobals();
|
|
const { disable } = await import("../tray/autostart.mjs");
|
|
const ok = disable();
|
|
emit({ disabled: ok }, globalOpts);
|
|
if (!ok) process.exit(1);
|
|
});
|
|
|
|
cmd
|
|
.command("status")
|
|
.description(t("autostart.status") || "Show autostart status")
|
|
.action(async (opts, c) => {
|
|
const globalOpts = c.optsWithGlobals();
|
|
const { isAutostartEnabled } = await import("../tray/autostart.mjs");
|
|
emit({ enabled: isAutostartEnabled() }, globalOpts);
|
|
});
|
|
}
|