Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(browser): honour an explicit GDK_SCALE=1 over Xft.dpi
Bugfixer 2b00bf0d3ad91
diff --git a/server/browser/display.test.ts b/server/browser/display.test.tsindex 2aebb31f17..70f624f1f8 100644--- a/server/browser/display.test.ts+++ b/server/browser/display.test.ts@@ -42,6 +42,7 @@ describe("the display a headless bot browser reports", () => {expect(await linux(new Error("no xrdb"))).toEqual({ width: 3840, height: 2160, deviceScaleFactor: 1 });expect(await linux("Xft.dpi:\t192\n", { DISPLAY: ":0", WAYLAND_DISPLAY: "wayland-0" })).toEqual({ width: 3840, height: 2160, deviceScaleFactor: 1 });expect(await linux("Xft.dpi:\t192\n", { DISPLAY: ":0", XDG_SESSION_TYPE: "wayland" })).toEqual({ width: 3840, height: 2160, deviceScaleFactor: 1 });+ expect(await linux("Xft.dpi:\t192\n", { DISPLAY: ":0", GDK_SCALE: "1" })).toEqual({ width: 3840, height: 2160, deviceScaleFactor: 1 });});it("is a declared 1920x1080 at 1x on a server or in a container, and when the desktop cannot be read", async () => {diff --git a/server/browser/display.ts b/server/browser/display.tsindex 4a4d080fd7..0ec1a7daaa 100644--- a/server/browser/display.ts+++ b/server/browser/display.ts@@ -48,9 +48,9 @@ export async function displayScreen(host: HostKind, { platform = process.platforconst pixels = parseDisplay(lines.find((line) => / primary /u.test(line)) ?? lines[0] ?? "");if (!pixels) return SERVER_SCREEN;const gdkScale = Number(env.GDK_SCALE);- // Under Wayland, XWayland's RandR size can already be logical, so Xft.dpi is only read in an X11 session.+ // An explicit GDK_SCALE wins, 1 included. Under Wayland, XWayland's RandR size can already be logical, so Xft.dpi is only read in an X11 session.const x11 = !env.WAYLAND_DISPLAY && env.XDG_SESSION_TYPE !== "wayland";- const scale = Number.isInteger(gdkScale) && gdkScale > 1 && gdkScale <= 4 ? gdkScale : x11 ? await xftScale(runCommand) : 1;+ const scale = Number.isInteger(gdkScale) && gdkScale >= 1 && gdkScale <= 4 ? gdkScale : x11 ? await xftScale(runCommand) : 1;return { width: Math.round(pixels.width / scale), height: Math.round(pixels.height / scale), deviceScaleFactor: scale };}} catch {}