A desktop coding agent with free access to frontier models.
TypeScript
fix: fit the window and composer on short laptop screens
ogsamrat8c9fc6742b9d
diff --git a/apps/app/src/react-app/domains/session/surface/composer/editor.tsx b/apps/app/src/react-app/domains/session/surface/composer/editor.tsxindex 4010d3ce..71bbacd9 100644--- a/apps/app/src/react-app/domains/session/surface/composer/editor.tsx+++ b/apps/app/src/react-app/domains/session/surface/composer/editor.tsx@@ -1417,13 +1417,14 @@ export const LexicalPromptEditor = forwardRef<LexicalPromptEditorHandle, EditorPTight start, bounded growth:- min-h holds the editor to a single-line look until the user starts typing.- max-h caps the composer — long pastes / multi-paragraph drafts scroll- inside the editor instead of pushing the transcript out of view.+ inside the editor instead of pushing the transcript out of view; in+ windows shorter than about 930 px it is 30% of the window height.*/}<div className="relative"><PlainTextPlugincontentEditable={<ContentEditable- className="min-h-[60px] max-h-[280px] w-full resize-none overflow-y-auto bg-transparent text-base leading-6 text-dls-text outline-none placeholder:text-dls-secondary lg:text-[13px] lg:leading-[1.55] [&_p]:min-h-[1.5rem] [&_p]:m-0"+ className="min-h-[60px] max-h-[clamp(120px,30vh,280px)] w-full resize-none overflow-y-auto bg-transparent text-base leading-6 text-dls-text outline-none placeholder:text-dls-secondary lg:text-[13px] lg:leading-[1.55] [&_p]:min-h-[1.5rem] [&_p]:m-0"aria-placeholder={props.placeholder}placeholder={<span />}onPaste={props.onPaste}diff --git a/apps/desktop/electron/main.mjs b/apps/desktop/electron/main.mjsindex 37969b98..1064d023 100644--- a/apps/desktop/electron/main.mjs+++ b/apps/desktop/electron/main.mjs@@ -24,6 +24,7 @@ import { registerMigrationIpc } from "./migration.mjs";import { createRuntimeManager, createSystemCaCertificateVerifyProc } from "./runtime.mjs";import { installAppRequestSecret } from "./app-request-secret.mjs";import { registerUpdaterIpc } from "./updater.mjs";+import { initialWindowSize } from "./window-size.mjs";import {browserActApproval,browserPermissionMode,@@ -149,6 +150,7 @@ const {powerMonitor,powerSaveBlocker,Notification: ElectronNotification,+ screen,session,shell,systemPreferences,@@ -3111,9 +3113,14 @@ async function createMainWindow() {app.dock.setIcon(windowIconImage);}+ let workArea = null;+ try {+ workArea = screen.getPrimaryDisplay().workAreaSize;+ } catch {+ // No display information: the preferred size.+ }mainWindow = new BrowserWindow({- width: 1180,- height: 820,+ ...initialWindowSize(workArea),title: currentDisplayAppName,show: false,...(process.platform === "win32" ? { skipTaskbar: true } : {}),diff --git a/apps/desktop/electron/window-size.mjs b/apps/desktop/electron/window-size.mjsnew file mode 100644index 00000000..f1023b9a--- /dev/null+++ b/apps/desktop/electron/window-size.mjs@@ -0,0 +1,13 @@+// The first window's size: the preferred size, never larger than the screen+// area left by the taskbar or dock. An 820 px tall window on a 768 px laptop+// (or 1080 px at 150 % scaling) opened with the composer below the screen.+export const PREFERRED_WINDOW_SIZE = Object.freeze({ width: 1180, height: 820 });++export function initialWindowSize(workArea, preferred = PREFERRED_WINDOW_SIZE) {+ const width = Math.floor(Number(workArea?.width));+ const height = Math.floor(Number(workArea?.height));+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {+ return { ...preferred };+ }+ return { width: Math.min(preferred.width, width), height: Math.min(preferred.height, height) };+}diff --git a/apps/desktop/electron/window-size.test.mjs b/apps/desktop/electron/window-size.test.mjsnew file mode 100644index 00000000..5a7b29e7--- /dev/null+++ b/apps/desktop/electron/window-size.test.mjs@@ -0,0 +1,23 @@+import assert from "node:assert/strict";+import { describe, it } from "node:test";+import { initialWindowSize } from "./window-size.mjs";++describe("initial window size", () => {+ it("keeps the preferred size on a large screen", () => {+ assert.deepEqual(initialWindowSize({ width: 1920, height: 1040 }), { width: 1180, height: 820 });+ });++ it("fits a 1366x768 laptop with a taskbar", () => {+ assert.deepEqual(initialWindowSize({ width: 1366, height: 728 }), { width: 1180, height: 728 });+ });++ it("fits 1280x720 and 1366x768 at 125 % scaling", () => {+ assert.deepEqual(initialWindowSize({ width: 1280, height: 680 }), { width: 1180, height: 680 });+ assert.deepEqual(initialWindowSize({ width: 1093, height: 582 }), { width: 1093, height: 582 });+ });++ it("never exceeds a tiny screen and falls back without a work area", () => {+ assert.deepEqual(initialWindowSize({ width: 600, height: 400 }), { width: 600, height: 400 });+ assert.deepEqual(initialWindowSize(null), { width: 1180, height: 820 });+ });+});diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex ad936ab7..0102f345 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -27,7 +27,7 @@"prepare:sidecar": "node ./scripts/prepare-sidecar.mjs","pretest": "pnpm --filter @omnirush/headless-threads build","test:omnirush-account": "node --test electron/omnirush-account.test.mjs",- "test": "node --test scripts/prepare-server-constants.test.mjs scripts/verify-update-manifest.test.mjs electron/after-pack-paths.test.mjs electron/agent-context-diagnostics-fetch.test.mjs electron/automation-runner.test.mjs electron/binary-transfer.test.mjs electron/blank-slate-profile.test.mjs electron/blank-slate-profile-isolation.test.mjs electron/brand-app-name.test.mjs electron/brand-icon-darwin.test.mjs electron/brand-icon-windows.test.mjs electron/browser-login-sync.test.mjs electron/browser-panel.test.mjs electron/browser-task.test.mjs electron/background-rendering.test.mjs electron/connect-link.test.mjs electron/desktop-distribution.test.mjs electron/dev-profile.test.mjs electron/electron-builder-config.test.mjs electron/linux-desktop-integration.test.mjs electron/linux-password-store.test.mjs electron/logs-folder.test.mjs electron/media-permissions.test.mjs electron/no-bare-external-fetch.test.mjs electron/nuke.test.mjs electron/omnirush-account.test.mjs electron/omnirush-ui-mcp.test.mjs electron/open-external.test.mjs electron/open-local-path.test.mjs electron/process-resilience.test.mjs electron/runtime.test.mjs electron/runtime-ca.test.mjs electron/system-ca-trust.test.mjs electron/external-fetch.test.mjs electron/runtime-chain-repair.test.mjs electron/sentry.test.mjs electron/server-dependency-mirror.test.mjs electron/skill-folder.test.mjs electron/secure-vault-key.test.mjs electron/stdio-errors.test.mjs electron/terminal-sessions.test.mjs electron/ui-control-server.test.mjs electron/updater.test.mjs electron/update-gate.test.mjs electron/quality.test.mjs electron/buildathon.test.mjs electron/build-variant.test.mjs electron/placements-desktop.test.mjs electron/feedback-desktop.test.mjs electron/turn-guard.test.mjs electron/keep-awake.test.mjs electron/computer-use-answers.test.mjs electron/remote-workspace.test.mjs electron/workspace-archive.test.mjs electron/workspace-store.test.mjs electron/start-report.test.mjs electron/start-reset.test.mjs electron/start-store-check.test.mjs electron/app-request-secret.test.mjs electron/disk-cleanup.test.mjs",+ "test": "node --test scripts/prepare-server-constants.test.mjs scripts/verify-update-manifest.test.mjs electron/after-pack-paths.test.mjs electron/agent-context-diagnostics-fetch.test.mjs electron/automation-runner.test.mjs electron/binary-transfer.test.mjs electron/blank-slate-profile.test.mjs electron/blank-slate-profile-isolation.test.mjs electron/brand-app-name.test.mjs electron/brand-icon-darwin.test.mjs electron/brand-icon-windows.test.mjs electron/browser-login-sync.test.mjs electron/browser-panel.test.mjs electron/browser-task.test.mjs electron/background-rendering.test.mjs electron/connect-link.test.mjs electron/desktop-distribution.test.mjs electron/dev-profile.test.mjs electron/electron-builder-config.test.mjs electron/linux-desktop-integration.test.mjs electron/linux-password-store.test.mjs electron/logs-folder.test.mjs electron/media-permissions.test.mjs electron/no-bare-external-fetch.test.mjs electron/nuke.test.mjs electron/omnirush-account.test.mjs electron/omnirush-ui-mcp.test.mjs electron/open-external.test.mjs electron/open-local-path.test.mjs electron/process-resilience.test.mjs electron/runtime.test.mjs electron/runtime-ca.test.mjs electron/system-ca-trust.test.mjs electron/external-fetch.test.mjs electron/runtime-chain-repair.test.mjs electron/sentry.test.mjs electron/server-dependency-mirror.test.mjs electron/skill-folder.test.mjs electron/secure-vault-key.test.mjs electron/stdio-errors.test.mjs electron/terminal-sessions.test.mjs electron/ui-control-server.test.mjs electron/updater.test.mjs electron/update-gate.test.mjs electron/window-size.test.mjs electron/quality.test.mjs electron/buildathon.test.mjs electron/build-variant.test.mjs electron/placements-desktop.test.mjs electron/feedback-desktop.test.mjs electron/turn-guard.test.mjs electron/keep-awake.test.mjs electron/computer-use-answers.test.mjs electron/remote-workspace.test.mjs electron/workspace-archive.test.mjs electron/workspace-store.test.mjs electron/start-report.test.mjs electron/start-reset.test.mjs electron/start-store-check.test.mjs electron/app-request-secret.test.mjs electron/disk-cleanup.test.mjs","test:core": "node --test scripts/prepare-server-constants.test.mjs electron/workspace-store.test.mjs electron/workspace-archive.test.mjs electron/connect-link.test.mjs electron/open-external.test.mjs electron/open-local-path.test.mjs electron/secure-vault-key.test.mjs electron/process-resilience.test.mjs electron/stdio-errors.test.mjs electron/runtime-ca.test.mjs electron/system-ca-trust.test.mjs electron/external-fetch.test.mjs electron/runtime-chain-repair.test.mjs electron/automation-runner.test.mjs","pretest:core": "pnpm --filter @omnirush/headless-threads build"},