Skip to content

Commit 81d5dbe

Browse files
committed
fix(desktop): show tray immediately with disabled init menu
1 parent eb57667 commit 81d5dbe

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

apps/desktop/electron/main.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ let mainWindow: BrowserWindow | null = null;
12521252
let tray: Tray | null = null;
12531253
let trayRefreshTimer: NodeJS.Timeout | null = null;
12541254
let trayIconState: RemoteState | null = null;
1255+
let trayInteractive = false;
12551256
let isQuitting = false;
12561257
let currentWindowMode: WindowMode = 'onboarding';
12571258
let currentWindowFocusSection: WindowFocusSection = null;
@@ -1375,6 +1376,33 @@ async function refreshTrayMenu() {
13751376
return;
13761377
}
13771378
const fallbackLocale = runtime.getConfig().locale;
1379+
if (!trayInteractive) {
1380+
setTrayIconState('offline');
1381+
tray.setToolTip(withLocale(fallbackLocale, 'Codex Bridge Desktop(正在启动)', 'Codex Bridge Desktop (starting)'));
1382+
tray.setContextMenu(Menu.buildFromTemplate([
1383+
{
1384+
label: 'Codex Bridge Desktop',
1385+
enabled: false,
1386+
},
1387+
{
1388+
label: withLocale(fallbackLocale, '⏳ 正在初始化,请稍候…', '⏳ Initializing, please wait...'),
1389+
enabled: false,
1390+
},
1391+
{
1392+
label: withLocale(fallbackLocale, '初始化完成后菜单将自动可用', 'Menu will be enabled automatically once ready'),
1393+
enabled: false,
1394+
},
1395+
{ type: 'separator' },
1396+
{
1397+
label: withLocale(fallbackLocale, '退出 Codex Bridge', 'Quit Codex Bridge'),
1398+
click: () => {
1399+
isQuitting = true;
1400+
app.quit();
1401+
},
1402+
},
1403+
]));
1404+
return;
1405+
}
13781406
const snapshot = await runtime.getAppSnapshot().catch(() => null);
13791407
if (!snapshot) {
13801408
setTrayIconState('offline');
@@ -1583,14 +1611,19 @@ async function bootstrap() {
15831611
}
15841612

15851613
await registerIpcHandlers();
1614+
if (!isAgentMode) {
1615+
// Show tray immediately (disabled menu) so users get instant feedback on app launch.
1616+
createTray();
1617+
}
15861618

15871619
if (!isAgentMode) {
15881620
runtime.startManagedLocalRelayIfNeeded();
15891621
}
15901622

15911623
await runtime.start();
1624+
trayInteractive = true;
15921625
if (!isAgentMode) {
1593-
createTray();
1626+
void refreshTrayMenu();
15941627
const snapshot = await runtime.getAppSnapshot().catch(() => null);
15951628
if (!snapshot || snapshot.onboardingStep < 5) {
15961629
showMainWindow('onboarding');

0 commit comments

Comments
 (0)