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

fix(desktop): real vibrancy — native rounded corners instead of transparent window

Tashfeen3b350f3bc679
diff --git a/renderer/popover.html b/renderer/popover.html
index b4ea16f6..f080b83a 100644
--- a/renderer/popover.html
+++ b/renderer/popover.html
@@ -13,21 +13,20 @@
--ok: #34c759;
}
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
- html, body { background: transparent; }
+ /* The window itself is the panel: native rounded corners + vibrancy show
+ through everywhere the page stays (near-)transparent. CSS adds only a
+ whisper of tint and the gloss sheen. */
+ html, body { background: transparent; height: 100%; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
-webkit-font-smoothing: antialiased;
color: var(--fg);
- padding: 8px;
}
.panel {
position: relative;
- border-radius: 18px;
- background: linear-gradient(180deg, rgba(46,46,52,0.62), rgba(28,28,32,0.66));
- box-shadow:
- inset 0 1px 0 rgba(255,255,255,0.14),
- inset 0 0 0 0.5px rgba(255,255,255,0.08),
- 0 18px 48px rgba(0,0,0,0.42);
+ height: 100%;
+ background: linear-gradient(180deg, rgba(40,40,46,0.18), rgba(20,20,24,0.22));
+ box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
overflow: hidden;
padding: 14px 14px 12px;
}
@@ -36,7 +35,7 @@
.panel::before {
content: "";
position: absolute; inset: 0 0 auto 0; height: 110px;
- background: radial-gradient(120% 100% at 50% -20%, rgba(255,255,255,0.16), rgba(255,255,255,0) 70%);
+ background: radial-gradient(120% 100% at 50% -20%, rgba(255,255,255,0.12), rgba(255,255,255,0) 70%);
pointer-events: none;
}
diff --git a/src/main.ts b/src/main.ts
index ca3c9ec6..4623063f 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -72,7 +72,9 @@ if (!app.requestSingleInstanceLock()) {
console.log(`[desktop] FreeLLMAPI running on http://127.0.0.1:${port}`);
// Dev-only UI verification: FREEAPI_SHOT=1 opens the popover and the
- // dashboard, captures both to /tmp, and quits. Never set when packaged.
+ // dashboard, captures both to /tmp, and quits. FREEAPI_SHOT=hold opens
+ // the popover and keeps it pinned (blur ignored) so a real screen
+ // capture can include the compositor's vibrancy. Never set when packaged.
if (process.env.FREEAPI_SHOT && !app.isPackaged) {
const fs = await import('node:fs');
const { togglePopover, getPopoverWindow } = await import('./popover.js');
@@ -80,6 +82,12 @@ if (!app.requestSingleInstanceLock()) {
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
await sleep(800);
togglePopover(tray);
+ if (process.env.FREEAPI_SHOT === 'hold') {
+ const pop = getPopoverWindow();
+ pop?.removeAllListeners('blur'); // stay open unfocused
+ if (pop) fs.writeFileSync('/tmp/freeapi-popover-bounds.json', JSON.stringify(pop.getBounds()));
+ return;
+ }
await sleep(1500);
const pop = await getPopoverWindow()?.webContents.capturePage();
if (pop) fs.writeFileSync('/tmp/freeapi-popover.png', pop.toPNG());
diff --git a/src/popover.ts b/src/popover.ts
index 1d6201c1..ef176ec2 100644
--- a/src/popover.ts
+++ b/src/popover.ts
@@ -4,21 +4,24 @@ import { BrowserWindow, type Tray } from 'electron';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
-const WIDTH = 332;
-const HEIGHT = 356;
+const WIDTH = 316;
+const HEIGHT = 348;
let popover: BrowserWindow | null = null;
-// A Control-Center-style glass panel anchored under the tray icon. Created
-// once, then shown/hidden — cheap to keep around (one small renderer) and
-// instant to open. Hides on blur like a real menu.
+// A Control-Center-style glass panel anchored under the tray icon.
+// Real macOS material: frameless window with SYSTEM rounded corners +
+// NSVisualEffectView vibrancy + native shadow. No `transparent: true` —
+// that path composites the window itself and defeats the vibrancy blur;
+// instead the page background stays transparent and the material shows
+// through. Created once, then shown/hidden; hides on blur like a menu.
function createPopover(): BrowserWindow {
const win = new BrowserWindow({
width: WIDTH,
height: HEIGHT,
show: false,
frame: false,
- transparent: true,
+ roundedCorners: true, // native macOS corner mask + matching shadow
resizable: false,
movable: false,
minimizable: false,
@@ -26,10 +29,16 @@ function createPopover(): BrowserWindow {
fullscreenable: false,
skipTaskbar: true,
alwaysOnTop: true,
- hasShadow: false, // the panel draws its own soft shadow (transparent margins)
...(process.platform === 'darwin'
- ? { vibrancy: 'popover' as const, visualEffectState: 'active' as const }
- : {}),
+ ? {
+ vibrancy: 'popover' as const,
+ visualEffectState: 'active' as const,
+ backgroundColor: '#00000000',
+ }
+ : {
+ // Windows 11 acrylic; older Windows falls back to the solid CSS bg.
+ backgroundMaterial: 'acrylic' as const,
+ }),
webPreferences: {
preload: path.join(__dirname, 'preload-popover.cjs'),
contextIsolation: true,
@@ -70,8 +79,8 @@ export function togglePopover(tray: Tray): void {
// Centered under the icon; tray bounds are in screen coordinates.
const x = Math.round(b.x + b.width / 2 - WIDTH / 2);
const y = process.platform === 'darwin'
- ? Math.round(b.y + b.height + 4)
- : Math.round(b.y - HEIGHT - 4); // Windows tray sits at the bottom
+ ? Math.round(b.y + b.height + 6)
+ : Math.round(b.y - HEIGHT - 6); // Windows tray sits at the bottom
popover.setPosition(x, y, false);
popover.webContents.send('freeapi:refresh');
popover.show();