Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ Releases before 0.1.9 predate this file — see the
## [Unreleased]

### Added
- **UI scale and zoom shortcuts.** Ctrl or Cmd with `=` (or `+`), `-` and `0` zoom the
window in, out and back to 100%, from 75% up to 300%, and Settings > General > UI scale
picks a size too. It is remembered, and the orb stays at its own size. (#60)
- **Russian speech recognition and voice replies.** Pick Russian in Settings > Voice
and OpenLive hears you with Parakeet v3, Whisper or Nemotron 3.5 and answers with
Supertonic or Piper (Denis or Dmitri). Numbers, dates, times, percentages, "№" and
rubles (₽) are read aloud in Russian too, and the interface font now covers Cyrillic.
The interface stays in English. (#61)

### Fixed
- **Ctrl+= now zooms in.** Only Ctrl+- worked before, because the menu's zoom in needed Shift.
- **An older Ctrl+- zoom carries over.** A zoom level set before UI scale existed becomes the nearest step on first launch.
- **The window fits small and scaled screens.** A first launch opens at most as large as the
screen's usable area, centered, and the window can always be resized down to fit the screen
it is on, such as a 1080p laptop at 150% scaling.
- **Layouts hold up at large zoom.** The call's orb shrinks to the room it has instead of
overlapping the hints and controls, the top bar folds its chips to icons in a narrow window,
the home page's version no longer sits over the buttons, and text sizes follow the root
size. (#60)

## [0.4.1] - 2026-11-11

### Changed
Expand Down
9 changes: 9 additions & 0 deletions apps/desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ NSIS installers run unsigned (users see a SmartScreen warning). To sign, provide
code-signing cert via electron-builder's `win.certificateFile` +
`CSC_KEY_PASSWORD`, or an Azure Trusted Signing / EV cert. Not required to ship.

## Zoom

`Ctrl`/`Cmd` + `=` (or `+`) zooms in, `-` zooms out, `0` resets, on the main window
only (also the numpad keys, and View in the menu). It moves through 75, 90, 100,
110, 125, 150, 175, 200, 250 and 300 percent, and Settings > General > UI scale
picks one too. The scale is kept in `<home>/state/appearance.json`. The orb stays
at 100 percent. On a first launch the window opens at most as large as the work
area of the screen it is on, and its minimum size follows the screen it moves to.

## What's in the package

```
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ files:
- splash.html
- telemetry-map.cjs
- window-state.cjs
- zoom.cjs
- login-item.cjs
- update-gate.cjs
- prev-exit.cjs
Expand Down
132 changes: 124 additions & 8 deletions apps/desktop/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const flowRuntime = require("./flow-runtime.cjs");
const { osHasGlass, glassSupport, effectiveLook } = require("./look.cjs");
const orbPointer = require("./orb-pointer.cjs");
const { isExternalUrl } = require("./external-url.cjs");
const { restoreWindow, windowSnapshot } = require("./window-state.cjs");
const { restoreWindow, minFor, fitRect, firstRunWindow, windowSnapshot } = require("./window-state.cjs");
const { sameZoom, sanitizeZoom, nextZoom, zoomKeyAction, legacyHostZoom, ZOOM_STEPS } = require("./zoom.cjs");
const { trayTemplate, orbOwner } = require("./tray-menu.cjs");
const { talkBindings, pttRouter } = require("./talk.cjs");
const { loginDefaultReady } = require("./login-item.cjs");
Expand Down Expand Up @@ -435,6 +436,7 @@ function agentArgs() {
// ── window bounds: remember size, position, maximized and fullscreen ─────────
const windowStateFile = () => stateFile("window-state.json");
const MAIN_MIN = { width: 940, height: 640 };
const MAIN_PREFERRED = { width: 1180, height: 800 };
function loadWindowState() {
let saved = null;
try { saved = JSON.parse(fs.readFileSync(windowStateFile(), "utf8")); } catch { /* no saved state */ }
Expand All @@ -444,6 +446,24 @@ function saveWindowState() {
if (!mainWin || mainWin.isDestroyed()) return;
try { writeAtomic(fs, windowStateFile(), JSON.stringify(windowSnapshot(mainWin))); } catch { /* best-effort */ }
}
/** The work area of the display `bounds` sits on, or the primary's for a window with no place yet. */
const workAreaOf = (bounds) => (bounds?.x != null ? screen.getDisplayMatching(bounds) : screen.getPrimaryDisplay()).workArea;
const mainDisplayId = () => screen.getDisplayMatching(mainWin.getBounds()).id;
/** Keeps the window usable on the display it is on: its minimum never exceeds that
* work area and, when `reclamp`, a window that no longer fits is brought back inside it.
* Never on a move (it would fight the person dragging), and only where the window's
* own screen lost room: a resize that follows is saved, so a passing change (a remote
* session, a projector, a taskbar that hides) must not shrink it for good. */
function fitMainWindow(reclamp = false) {
if (!mainWin || mainWin.isDestroyed()) return;
const bounds = mainWin.getBounds();
const work = workAreaOf(bounds);
const min = minFor(MAIN_MIN, work);
mainWin.setMinimumSize(min.width, min.height);
if (!reclamp || mainWin.isMaximized() || mainWin.isFullScreen() || mainWin.isMinimized()) return;
const fit = fitRect(bounds, work, MAIN_MIN);
if (["x", "y", "width", "height"].some((k) => fit[k] !== bounds[k])) mainWin.setBounds(fit);
}

// ── one-time things (first ⌘Q notice, the login-item default) ────────────────
const onceFile = () => stateFile("once.json");
Expand Down Expand Up @@ -475,13 +495,28 @@ const CLEAR = "#00000000";
const PAGE_BG = { dark: "#0b0b0c", light: "#efede8" }; // --background in .dark / :root
const THEMES = new Set(["system", "light", "dark"]);
const appearanceFile = () => stateFile("appearance.json");
let appearance = {}; // { theme, look, probe: { version, slow } }
let appearance = {}; // { theme, look, zoom, probe: { version, slow } }
let look = "flat"; // what the main window wears right now
let lookTimer = null;
let winTransparencyOff = false;
let zoom = 1; // the main window's UI scale, one of ZOOM_STEPS

function legacyZoom() {
try { return legacyHostZoom(JSON.parse(fs.readFileSync(path.join(app.getPath("userData"), "Preferences"), "utf8")), WEB_HOST); } catch { return null; }
}
function loadAppearance() {
try { appearance = JSON.parse(fs.readFileSync(appearanceFile(), "utf8")) || {}; } catch { appearance = {}; }
let writable = false; // only a missing file or a valid object may be written back; anything else might be recoverable
appearance = {};
try {
const parsed = JSON.parse(fs.readFileSync(appearanceFile(), "utf8"));
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) { appearance = parsed; writable = true; }
} catch (e) { writable = e.code === "ENOENT"; }
if (appearance.zoom === undefined) {
// Before the scale was kept here, Chromium kept the main window's as a per-host zoom level.
appearance.zoom = legacyZoom() ?? 1; // kept even when none, so Preferences is read once
if (writable) saveAppearance();
}
zoom = sanitizeZoom(appearance.zoom);
// Native surfaces (the material's tint, the title bar) follow the app's theme, not the OS's.
nativeTheme.themeSource = THEMES.has(appearance.theme) ? appearance.theme : "system";
readWinTransparency();
Expand Down Expand Up @@ -602,6 +637,39 @@ function wireAppearance() {
app.on("gpu-info-update", refreshLook);
}

// ── zoom: the main window's UI scale, kept in appearance.json beside the theme ─
// Chromium zooms per origin and every window here is on the same one, so a level
// set on the main window would scale the orb and the hidden owner with it. Every
// window therefore opens `zoomMode: "isolated"` (its own level), and the orb and
// the owner are held at 100% (holdZoom).
const zoomState = () => ({ factor: zoom, steps: ZOOM_STEPS });

/** Holds `wc` at `factor()` now and after every load, so a reload never leaves it at the origin's level. */
function holdZoom(wc, factor) {
const apply = () => { if (!wc.isDestroyed() && !sameZoom(wc.getZoomFactor(), factor())) wc.setZoomFactor(factor()); };
apply();
wc.on("dom-ready", apply);
}

function setZoom(v) {
const next = sanitizeZoom(v);
if (next !== zoom) {
zoom = next;
appearance.zoom = next;
saveAppearance();
if (mainWin && !mainWin.isDestroyed()) {
mainWin.webContents.setZoomFactor(zoom);
mainWin.webContents.send("openlive:zoom-changed", zoomState());
}
}
return zoomState();
}

function wireZoom() {
ipcMain.on("openlive:zoom", (e) => { e.returnValue = zoomState(); });
ipcMain.handle("openlive:zoom-set", (e, v) => (isMainWc(e.sender) && Number.isFinite(v) ? setZoom(v) : zoomState()));
}

// ── windows ──────────────────────────────────────────────────────────────────
function createSplash() {
splashWin = new BrowserWindow({
Expand All @@ -617,9 +685,11 @@ function createSplash() {

function createMainWindow() {
const saved = loadWindowState();
const start = saved ?? firstRunWindow(MAIN_PREFERRED, screen.getDisplayNearestPoint(screen.getCursorScreenPoint()).workArea, MAIN_MIN);
const min = minFor(MAIN_MIN, workAreaOf(start));
mainWin = new BrowserWindow({
width: saved?.width || 1180, height: saved?.height || 800, minWidth: MAIN_MIN.width, minHeight: MAIN_MIN.height,
...(saved && saved.x != null ? { x: saved.x, y: saved.y } : {}),
width: start.width, height: start.height, minWidth: min.width, minHeight: min.height,
...(start.x != null ? { x: start.x, y: start.y } : {}),
show: false,
// Never `transparent: true`: transparent windows take a slower macOS compositing
// path that competes with the on-device WebGPU voice models (adds turn latency),
Expand All @@ -641,6 +711,8 @@ function createMainWindow() {
// in-origin) — keep it in the Chromium sandbox. The preload only uses
// contextBridge/ipcRenderer, which are available in sandboxed preloads.
sandbox: true,
// The UI scale is this window's own (see the zoom section), set before its first frame.
zoomMode: "isolated", zoomFactor: zoom,
// A call keeps running while this window is minimised or hidden, and its
// renderer runs the whole voice pipeline: throttled timers would wreck
// turn-taking (hold timers, TTS drain).
Expand All @@ -657,6 +729,25 @@ function createMainWindow() {
},
});
for (const ev of ["resize", "move", "close", "maximize", "unmaximize", "enter-full-screen", "leave-full-screen"]) mainWin.on(ev, saveWindowState);
// A new display brings its own work area, so its minimum size has to follow. `moved`
// is macOS and Windows only, so this listens to `move` and acts when the display changes.
let onDisplay = null;
mainWin.on("move", () => {
const id = mainDisplayId();
if (id === onDisplay) return;
onDisplay = id;
fitMainWindow();
});
holdZoom(mainWin.webContents, () => zoom);
// The menu's zoom accelerators are display only (menu click below). A key
// handled here is claimed, which stops the menu's own accelerator for it, so
// one press steps once, and it works on layouts where the menu's does not.
mainWin.webContents.on("before-input-event", (e, input) => {
const action = zoomKeyAction(input, process.platform);
if (!action) return;
e.preventDefault();
setZoom(nextZoom(zoom, action));
});
// A backstop for OS settings that change without telling nativeTheme.
mainWin.on("focus", refreshLook);
mainWin.on("focus", () => telemetry.markActiveDay("main_window"));
Expand Down Expand Up @@ -727,8 +818,9 @@ function makePanelWindow(route, bounds) {
// on Windows, and one the window manager never focuses on Linux.
focusable: false,
...(process.platform === "darwin" ? { type: "panel" } : {}),
webPreferences: { preload: path.join(__dirname, "preload.cjs"), contextIsolation: true, nodeIntegration: false, sandbox: true, backgroundThrottling: false },
webPreferences: { preload: path.join(__dirname, "preload.cjs"), contextIsolation: true, nodeIntegration: false, sandbox: true, backgroundThrottling: false, zoomMode: "isolated", zoomFactor: 1 },
});
holdZoom(win.webContents, () => 1);
win.setAlwaysOnTop(true, "floating", 1);
win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true, skipTransformProcessType: true });
// Electron's panel still activates OpenLive on a click, bringing the main
Expand Down Expand Up @@ -805,8 +897,9 @@ function createOwnerWindow() {
if (ownerWin && !ownerWin.isDestroyed()) return ownerWin;
ownerWin = new BrowserWindow({
width: 480, height: 320, show: false, skipTaskbar: true,
webPreferences: { preload: path.join(__dirname, "preload.cjs"), contextIsolation: true, nodeIntegration: false, sandbox: true, backgroundThrottling: false, additionalArguments: agentArgs() },
webPreferences: { preload: path.join(__dirname, "preload.cjs"), contextIsolation: true, nodeIntegration: false, sandbox: true, backgroundThrottling: false, zoomMode: "isolated", zoomFactor: 1, additionalArguments: agentArgs() },
});
holdZoom(ownerWin.webContents, () => 1);
ownerWin.loadURL(`${WEB_URL}/flow-owner`);
ownerWin.webContents.on("did-start-loading", () => { ownerReady = false; });
// Loaded means the web server answers, so Dictate's state can be read for the tray.
Expand Down Expand Up @@ -1373,6 +1466,12 @@ function wireWindowIpc() {
telemetry.track("remote_ollama_prompt", { outcome, scheme: u.protocol === "https:" ? "https" : "http" });
}
});
screen.on("display-added", () => fitMainWindow());
screen.on("display-removed", () => fitMainWindow(true));
screen.on("display-metrics-changed", (_e, display, changed) => {
const room = changed.some((m) => m === "workArea" || m === "bounds" || m === "scaleFactor");
fitMainWindow(room && !!mainWin && !mainWin.isDestroyed() && mainDisplayId() === display.id);
});
ipcMain.on("openlive:win-close", () => { if (mainWin) mainWin.close(); });
ipcMain.on("openlive:win-min", () => { if (mainWin) mainWin.minimize(); });
ipcMain.on("openlive:win-zoom", () => {
Expand Down Expand Up @@ -1564,6 +1663,14 @@ function buildMenu() {
{ label: `Close to ${isMac ? "Menu Bar" : "Tray"}`, accelerator: "CmdOrCtrl+Q", click: closeToMenuBar },
{ label: "Quit OpenLive", click: () => quitApp("app_menu") },
];
// The role's Zoom In wants Shift (its accelerator is Ctrl+Plus), which left Ctrl+= dead.
// The key itself is handled in createMainWindow, so a click is all this item answers.
const zoomItem = (label, accelerator, action) => ({
label, accelerator,
// Electron flags every click with no mouse button as an accelerator (VoiceOver and
// menu-key activations included), so only one with Ctrl or Cmd down is the shortcut itself.
click: (_item, _win, e) => { if (!(e.triggeredByAccelerator && (e.ctrlKey || e.metaKey))) setZoom(nextZoom(zoom, action)); },
});
const template = [
...(isMac ? [{ role: "appMenu", submenu: [
{ role: "about", label: "About OpenLive" },
Expand All @@ -1577,7 +1684,15 @@ function buildMenu() {
{ type: "separator" }, ...closeItems,
] }] : [{ label: "File", submenu: closeItems }]),
{ role: "editMenu" },
{ role: "viewMenu" },
{ label: "View", submenu: [
{ role: "reload" }, { role: "forceReload" }, { role: "toggleDevTools" },
{ type: "separator" },
zoomItem("Actual Size", "CommandOrControl+0", "reset"),
zoomItem("Zoom In", "CommandOrControl+=", "in"),
zoomItem("Zoom Out", "CommandOrControl+-", "out"),
{ type: "separator" },
{ role: "togglefullscreen" },
] },
{ role: "windowMenu" },
{ role: "help", submenu: [
{ label: "OpenLive on GitHub", click: () => shell.openExternal("https://github.com/katipally/openlive") },
Expand Down Expand Up @@ -1693,6 +1808,7 @@ async function boot() {
loadAppearance();
loadPreferences();
wireAppearance();
wireZoom();
wirePermissions();
wirePanelIpc();
wireNotifyIpc();
Expand Down
8 changes: 8 additions & 0 deletions apps/desktop/preload.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ contextBridge.exposeInMainWorld("openlive", {
set: (patch) => ipcRenderer.invoke("openlive:appearance-set", patch),
onChange: (cb) => listen("openlive:appearance-changed", cb),
},
// The main window's UI scale, the same way: `get` is synchronous. Resolves /
// delivers { factor, steps }, `factor` being one of `steps` (1 is 100%). `set`
// takes a factor and snaps it to the nearest step; the shortcuts move it too.
zoom: {
get: () => ipcRenderer.sendSync("openlive:zoom"),
set: (factor) => ipcRenderer.invoke("openlive:zoom-set", factor),
onChange: (cb) => listen("openlive:zoom-changed", cb),
},
// Product-usage telemetry. Main checks every message against its schema and keeps
// nothing else; only the main window and Flow's owner are heard. get() resolves to
// { active, enabled, noticeSeen, installIdTail, username, feedback, appVersion, osName, osMajor }, and
Expand Down
28 changes: 27 additions & 1 deletion apps/desktop/window-state.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,35 @@ function restoreWindow(saved, { displays, primary, min }) {
};
}

/** The smallest the window may be on `work`: its minimum, or the whole work
* area where that is smaller, so a small or heavily scaled screen never has a
* window it cannot fit. */
const minFor = (min, work) => ({ width: Math.min(min.width, work.width), height: Math.min(min.height, work.height) });

/** `rect` shrunk to fit `work` (not under `minFor`) and pulled inside it. */
function fitRect(rect, work, min) {
const m = minFor(min, work);
const width = Math.round(clamp(rect.width, m.width, work.width));
const height = Math.round(clamp(rect.height, m.height, work.height));
return {
x: Math.round(clamp(rect.x, work.x, work.x + work.width - width)),
y: Math.round(clamp(rect.y, work.y, work.y + work.height - height)),
width, height,
};
}

/** The first launch's window: `preferred` size, shrunk to the work area of the
* display it opens on and centered in it. */
function firstRunWindow(preferred, work, min) {
const m = minFor(min, work);
const width = Math.round(clamp(preferred.width, m.width, work.width));
const height = Math.round(clamp(preferred.height, m.height, work.height));
return { x: work.x + Math.round((work.width - width) / 2), y: work.y + Math.round((work.height - height) / 2), width, height };
}

/** What to save: the bounds it returns to, whatever state it is in now. */
function windowSnapshot(win) {
return { ...win.getNormalBounds(), maximized: win.isMaximized(), fullscreen: win.isFullScreen() };
}

module.exports = { restoreWindow, windowSnapshot };
module.exports = { restoreWindow, minFor, fitRect, firstRunWindow, windowSnapshot };
Loading
Loading