Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Train fix: keep electron/main.mjs at its pinned 3,124 lines for the Linux tray
milind-soni5bbc7d808c38
diff --git a/electron/main.mjs b/electron/main.mjsindex 95b9933bae..1312a6c575 100644--- a/electron/main.mjs+++ b/electron/main.mjs@@ -41,9 +41,7 @@ import { createActivityWindow } from "./lending-activity-window.mjs";import { missingPermissions } from "./lent-screen-failures.mjs";import { createScreenControl } from "./screen-control.mjs"; import { createAskPrompt } from "./ask-prompt.mjs";let startupScreen = null;-let desktopTray = null;-// Linux: an icon in the top bar to open or quit. The window never hides into it: not every desktop shows the icon.-let linuxTray = null;+let desktopTray = null, linuxTray = null; // Linux: an Open/Quit icon the window never hides into, since not every desktop shows it.import { collisionFreeDownloadPath, defaultSaveName, openFolder, openHtmlCopy, openLogsFolder, revealDownloadWhenDone, revealInFolder, withSavableFile } from "./save-file.mjs";import { desktopViewerPermissionAllowed } from "./desktop-viewer-permissions.mjs";import { appPermissionHandlers, externalLinkUrl } from "./app-permissions.mjs";@@ -1482,9 +1480,7 @@ const lendingActivity = createActivityWindow({ BrowserWindow, icon: APP_ICON, balet lendingTray = null;function lendingIndicator() {lendingTray ??= createLendingIndicator({- // On Linux the lending indicator borrows the one tray icon: a second one would be a GtkStatusIcon nobody sees.- Tray: linuxTray ? class { constructor() { return linuxTray.borrow(); } } : Tray,- Menu, nativeImage, Notification, iconPath: APP_ICON, t: nativeT, onPause: () => sharingController().pause(), onActivity: () => lendingActivity.show(),+ Tray: linuxTray?.Borrowed ?? Tray, Menu, nativeImage, Notification, iconPath: APP_ICON, t: nativeT, onPause: () => sharingController().pause(), onActivity: () => lendingActivity.show(),onResume: () => void sharingController().resume()?.catch(error => slog(`lending resume: ${error?.message ?? error}`)), onStartScreen: () => void screenControl.start(),onTerminal: on => void lendingDialogs.lendTerminal(on, () => sharingController().lendTerminal(on)).catch(error => slog(`lending terminal: ${error?.message ?? error}`)), onQuit: process.platform === "win32" || linuxTray ? () => app.quit() : null,});@@ -2797,8 +2793,7 @@ app.whenReady().then(async () => { launchRecord.mark("ready");});if (process.platform === "win32" || process.platform === "linux") {try {- const tray = createSystemTray({- Tray, Menu, nativeImage, iconPath: APP_ICON, t: nativeT,+ const tray = createSystemTray({ Tray, Menu, nativeImage, iconPath: APP_ICON, t: nativeT,getWindow: () => startupScreen?.window ?? mainWindow ?? (openWindowForLink?.(), mainWindow),onQuit: () => app.quit(),});diff --git a/electron/startup-tray.node-test.mjs b/electron/startup-tray.node-test.mjsindex f32c315665..500ada60b8 100644--- a/electron/startup-tray.node-test.mjs+++ b/electron/startup-tray.node-test.mjs@@ -258,7 +258,7 @@ test("on Linux the lending indicator borrows the one tray icon and hands Open anconst tray = createSystemTray({ ...fakes, Tray, getWindow: () => win, onQuit: () => {} });const labels = () => made[0].menu.filter(item => item.label).map(item => item.label);const openQuit = labels();- const lending = createLendingIndicator({ ...fakes, Tray: class { constructor() { return tray.borrow(); } },+ const lending = createLendingIndicator({ ...fakes, Tray: tray.Borrowed,onPause: () => {}, onResume: () => {}, onActivity: () => {}, device: "PC" });win.on("show", () => opened.push("show"));diff --git a/electron/system-tray.mjs b/electron/system-tray.mjsindex 63f98c0011..cca6fac000 100644--- a/electron/system-tray.mjs+++ b/electron/system-tray.mjs@@ -54,6 +54,8 @@ export function createSystemTray({ Tray, Menu, nativeImage, iconPath, getWindow,},};},+ /** A Tray class for the lending indicator: constructing one borrows this icon instead of making a second. */+ get Borrowed() { const owner = this; return class { constructor() { return owner.borrow(); } }; },destroy() { if (!tray.isDestroyed()) tray.destroy(); },};}