From 242a710f458cd2af3174d1267f9cb185b0413fbd Mon Sep 17 00:00:00 2001 From: MattModeCode <168686597+MattModeCode@users.noreply.github.com> Date: Fri, 4 Dec 2026 02:38:32 -0500 Subject: [PATCH] fix: never raise the settings window on activation or login launch --- src/app/main.cjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/main.cjs b/src/app/main.cjs index bb8009f..298ebaa 100644 --- a/src/app/main.cjs +++ b/src/app/main.cjs @@ -40,12 +40,13 @@ const STATUS_TEXT_LIMIT = 80; const smokeTest = process.argv.includes('--smoke-test'); // Started by the `avenue` command for an assistant: stay in the tray, show no window. -const startedHidden = process.argv.includes('--hidden'); +// A login launch is also silent: the app waits in the tray until the person opens it. +const startedHidden = process.argv.includes('--hidden') || (process.platform === 'darwin' && app.getLoginItemSettings().wasOpenedAtLogin); app.setName('Avenue Sync'); if (smokeTest) app.setPath('userData', path.join(os.tmpdir(), `avenue-sync-smoke-${process.pid}`)); if (!smokeTest && !app.requestSingleInstanceLock()) app.exit(0); app.on('second-instance', (_event, argv) => { if (!argv.includes('--hidden')) showSettings(); }); -app.on('activate', () => showSettings()); +// No 'activate' handler: macOS activates the app for a clicked notification or an `open -g`, and that must not raise the window. The tray menu opens it. let tray; let win; @@ -485,7 +486,7 @@ app.whenReady().then(async () => { createTray(); await startApi(); syncCliCopy(app.getPath('userData')); - app.setLoginItemSettings({ openAtLogin: app.isPackaged && !smokeTest }); + app.setLoginItemSettings({ openAtLogin: app.isPackaged && !smokeTest, args: ['--hidden'] }); if (smokeTest) { log('Smoke test passed.'); setTimeout(() => app.exit(0), 500); return; } sessions.start(); void scheduler.start();