Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(desktop): silence Wayland color-manager errors on KDE Plasma 6 (#6581)

Liam630712556abf
diff --git a/electron/linux-gpu.mjs b/electron/linux-gpu.mjs
index 6ef033fd0a..3f2b1ded8d 100644
--- a/electron/linux-gpu.mjs
+++ b/electron/linux-gpu.mjs
@@ -10,3 +10,9 @@ export function linuxDisablesGpu({ env = process.env, exists = fs.existsSync } =
// The main window's page is told so its glass pop-ups drop the backdrop blur, which is redrawn on the CPU here.
export const SOFTWARE_RENDERING_ARG = "--omb-software-rendering=1";
+
+// Chromium in Electron 43 binds KWin's wp_color_manager_v1 and logs "Unable to set image transfer function" on Plasma 6 Wayland.
+export function disableWaylandColorManager(commandLine) {
+ const disabled = commandLine.getSwitchValue("disable-features");
+ commandLine.appendSwitch("disable-features", [disabled, "WaylandWpColorManagerV1"].filter(Boolean).join(","));
+}
diff --git a/electron/linux-gpu.node-test.mjs b/electron/linux-gpu.node-test.mjs
index 42d985b0fd..acaf82f070 100644
--- a/electron/linux-gpu.node-test.mjs
+++ b/electron/linux-gpu.node-test.mjs
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
-import { linuxDisablesGpu, SOFTWARE_RENDERING_ARG } from "./linux-gpu.mjs";
+import { disableWaylandColorManager, linuxDisablesGpu, SOFTWARE_RENDERING_ARG } from "./linux-gpu.mjs";
const only = (...paths) => (p) => paths.includes(p);
@@ -30,3 +30,13 @@ test("the main window tells its page when it renders without a GPU, so pop-ups d
// My Cloud's page is remote: it needs the flag too.
assert.match(preload, /const REMOTE_SAFE = new Set\(\[[^\]]*"softwareRendering"/);
});
+
+test("the Wayland color manager is disabled and an existing disable-features list is kept", () => {
+ const run = (existing) => {
+ const switches = new Map();
+ disableWaylandColorManager({ getSwitchValue: () => existing, appendSwitch: (name, value) => switches.set(name, value) });
+ return switches.get("disable-features");
+ };
+ assert.equal(run(""), "WaylandWpColorManagerV1");
+ assert.equal(run("Foo,Bar"), "Foo,Bar,WaylandWpColorManagerV1");
+});
diff --git a/electron/main.mjs b/electron/main.mjs
index 17472a8196..4e8e2d8d1d 100644
--- a/electron/main.mjs
+++ b/electron/main.mjs
@@ -11,7 +11,7 @@ import { createAndroidDeviceController } from "./android-device.mjs";
import { finishSpeech, speechBusy, startSpeech, stopSpeech } from "./speech.mjs";
import { installTalk, isTalkPanel } from "./talk-main.mjs";
import { openBlankTerminal } from "./terminal-launch.mjs";
-import { linuxDisablesGpu, SOFTWARE_RENDERING_ARG } from "./linux-gpu.mjs";
+import { disableWaylandColorManager, linuxDisablesGpu, SOFTWARE_RENDERING_ARG } from "./linux-gpu.mjs";
import { contextMenuTemplate, createMediaDownloads } from "./context-menu.mjs";
import { attachUpdaterWindow, startUpdater, registerUpdaterIpc, sendUpdaterState, reopenedOutOfSight, quietSignals, unattendedUpdates } from "./updater.mjs"; import { installAlwaysOnHome } from "./always-on-home.mjs";
import {
@@ -181,7 +181,7 @@ function applyUnreadBadge(win = mainWindow) {
// A launch with --disable-gpu (a desktop entry or a user workaround) renders on the CPU too.
const linuxSoftwareRendering = process.platform === "linux" && (linuxDisablesGpu() || app.commandLine.hasSwitch("disable-gpu"));
if (linuxSoftwareRendering) app.disableHardwareAcceleration();
-if (process.platform === "linux") app.setDesktopName("com.openmausbot.app.desktop");
+if (process.platform === "linux") { app.setDesktopName("com.openmausbot.app.desktop"); disableWaylandColorManager(app.commandLine); }
if (!app.requestSingleInstanceLock()) {
console.log("[desktop] OpenMausBot is already running — focusing that window");