Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

feat(desktop): Show Compact Panel tray menu item on Windows (#1419)

suantea (asuan_suan)48e63e9a2566
diff --git a/desktop/src/__tests__/tray-platform.test.ts b/desktop/src/__tests__/tray-platform.test.ts
index 6b2f3ff9..18095f94 100644
--- a/desktop/src/__tests__/tray-platform.test.ts
+++ b/desktop/src/__tests__/tray-platform.test.ts
@@ -2,8 +2,9 @@ import { existsSync, readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
+import { dt, NATIVE_LOCALES } from '../i18n.js';
import { describe, expect, it } from 'vitest';
-import { shouldOpenDashboardOnLaunch, trayPlatform } from '../tray-platform.js';
+import { shouldOpenDashboardOnLaunch, trayMenuOffersPopover, trayPlatform } from '../tray-platform.js';
// #1353: on Windows the tray failed with "Unable to create status tray icon"
// because every platform got the macOS template PNG. The Windows branch never
@@ -78,3 +79,27 @@ describe('opening the dashboard at launch (#1353)', () => {
}
});
});
+
+describe('the compact popover keeps an entry point (#1412)', () => {
+ it('names the panel in the tray menu only where left-click does not toggle it', () => {
+ expect(trayMenuOffersPopover('win32')).toBe(true);
+ for (const platform of ['darwin', 'linux'] as const) {
+ expect(trayMenuOffersPopover(platform)).toBe(false);
+ }
+ });
+
+ // What #1412 broke: Windows gave left-click to the dashboard and nothing else
+ // could open the popover. A platform added later must not slip through, and
+ // dt() falls back to English for a missing key, so each locale is compared
+ // against the English label rather than just checked for a non-empty string.
+ it('leaves every supported platform a route to the popover, in every locale', () => {
+ for (const platform of ['darwin', 'win32', 'linux'] as const) {
+ const reachable = trayPlatform(platform).leftClick === 'popover' || trayMenuOffersPopover(platform);
+ expect(reachable, `${platform}: no way to open the compact panel`).toBe(true);
+ }
+ const english = dt('en', 'showCompactPanel');
+ for (const locale of NATIVE_LOCALES.filter(l => l !== 'en')) {
+ expect(dt(locale, 'showCompactPanel'), `${locale} is untranslated`).not.toBe(english);
+ }
+ });
+});
diff --git a/desktop/src/i18n.ts b/desktop/src/i18n.ts
index 70c0bc17..29e5ac76 100644
--- a/desktop/src/i18n.ts
+++ b/desktop/src/i18n.ts
@@ -28,6 +28,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — local LLM router',
runningOn: 'Running on {addr}',
openDashboard: 'Open Dashboard',
+ showCompactPanel: 'Show Compact Panel',
lanAccess: 'Allow LAN access (0.0.0.0)',
showInDock: 'Show in Dock',
openLogs: 'Open Logs Folder',
@@ -63,6 +64,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — 本地 LLM 路由器',
runningOn: '运行于 {addr}',
openDashboard: '打开仪表板',
+ showCompactPanel: '显示紧凑面板',
lanAccess: '允许局域网访问 (0.0.0.0)',
showInDock: '在程序坞中显示',
openLogs: '打开日志文件夹',
@@ -98,6 +100,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — routeur LLM local',
runningOn: 'En cours sur {addr}',
openDashboard: 'Ouvrir le tableau de bord',
+ showCompactPanel: 'Afficher la fenêtre compacte',
lanAccess: 'Autoriser l\'accès LAN (0.0.0.0)',
showInDock: 'Afficher dans le Dock',
openLogs: 'Ouvrir le dossier des journaux',
@@ -133,6 +136,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — enrutador LLM local',
runningOn: 'En ejecución en {addr}',
openDashboard: 'Abrir el panel',
+ showCompactPanel: 'Mostrar ventana compacta',
lanAccess: 'Permitir acceso LAN (0.0.0.0)',
showInDock: 'Mostrar en el Dock',
openLogs: 'Abrir la carpeta de registros',
@@ -168,6 +172,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — roteador LLM local',
runningOn: 'Em execução em {addr}',
openDashboard: 'Abrir o painel',
+ showCompactPanel: 'Mostrar janela compacta',
lanAccess: 'Permitir acesso LAN (0.0.0.0)',
showInDock: 'Mostrar no Dock',
openLogs: 'Abrir a pasta de logs',
@@ -203,6 +208,7 @@ const STRINGS: Record<NativeLocale, Strings> = {
tooltip: 'FreeLLMAPI — router LLM locale',
runningOn: 'In esecuzione su {addr}',
openDashboard: 'Apri il pannello',
+ showCompactPanel: 'Mostra finestra compatta',
lanAccess: 'Consenti accesso LAN (0.0.0.0)',
showInDock: 'Mostra nel Dock',
openLogs: 'Apri la cartella dei log',
diff --git a/desktop/src/tray-platform.ts b/desktop/src/tray-platform.ts
index 4c56b5e0..44fe10d6 100644
--- a/desktop/src/tray-platform.ts
+++ b/desktop/src/tray-platform.ts
@@ -31,6 +31,15 @@ export function trayPlatform(platform: NodeJS.Platform): TrayPlatform {
return { iconFile: 'tray.png', templateImage: false, leftClick: 'popover' };
}
+// #1412: the compact popover has no keyboard shortcut and no window of its own,
+// so the tray is its only entry point. Where left-click is already claimed by
+// the dashboard (Windows, deliberately, since #1353) the tray menu has to offer
+// it or the popover is unreachable. Elsewhere left-click toggles it already and
+// the item would just be a second way to do the same thing.
+export function trayMenuOffersPopover(platform: NodeJS.Platform): boolean {
+ return trayPlatform(platform).leftClick !== 'popover';
+}
+
// Windows tucks new tray icons into the overflow flyout, so a first launch can
// look like nothing happened at all (#1353). Open the dashboard once there so
// the user sees the app is up; after that the tray is the way in. A tray that
diff --git a/desktop/src/tray.ts b/desktop/src/tray.ts
index 0cdbf1ea..c5c03dba 100644
--- a/desktop/src/tray.ts
+++ b/desktop/src/tray.ts
@@ -5,7 +5,7 @@ import { togglePopover } from './popover.js';
import { openDashboard } from './window.js';
import { openLogsFolder, openBackupsFolder } from './logger.js';
import { dt, type NativeLocale } from './i18n.js';
-import { trayPlatform } from './tray-platform.js';
+import { trayMenuOffersPopover, trayPlatform } from './tray-platform.js';
import type { UpdateState } from './update-support.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -51,6 +51,12 @@ export function buildTray(
tray!.popUpContextMenu(Menu.buildFromTemplate([
{ label: dt(locale, 'runningOn', { addr: `${lanOn ? '0.0.0.0' : '127.0.0.1'}:${port}` }), enabled: false },
{ label: dt(locale, 'openDashboard'), click: () => openDashboard(port, token) },
+ // #1412: on Windows left-click deliberately opens the dashboard instead of
+ // the popover (#1353), which used to leave the compact panel with no entry
+ // point at all. Only offer it where the click does not already toggle it.
+ ...(trayMenuOffersPopover(process.platform)
+ ? [{ label: dt(locale, 'showCompactPanel'), click: () => togglePopover(tray!) }]
+ : []),
{ type: 'separator' },
// Toggling relaunches the app (the bind host is fixed at server start).
{ label: dt(locale, 'lanAccess'), type: 'checkbox', checked: lanOn, click: () => onToggleLanAccess() },