Skip to content

Commit 00b3122

Browse files
committed
fix(electron): remove hardware-accel disable and x11 force — fixes blank window
The blank window on Hyprland was caused by app.disableHardwareAcceleration() combined with forced X11/XWayland flags. This triggers a Chromium bug where the software bitmap presenter fails with 'XGetWindowAttributes failed for window 1'. Simplification: - Remove disableHardwareAcceleration (not needed, CSS fast profile handles visuals) - Remove all X11/XWayland force flags (let Electron auto-detect) - Remove transparent/hasShadow/paintWhenInitiallyHidden (unnecessary complexity) - Use simple ready-to-show + show() for all platforms The CSS fast render profile (already active) disables transitions and animations, which eliminates the visual flickering without needing GPU tweaks.
1 parent 9df456d commit 00b3122

1 file changed

Lines changed: 4 additions & 29 deletions

File tree

apps/desktop-electron/src/main.ts

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ const isDev = process.argv.includes("--dev");
1919
const gotTheLock = app.requestSingleInstanceLock();
2020

2121
if (process.platform === "linux") {
22-
app.disableHardwareAcceleration();
23-
app.commandLine.appendSwitch("disable-gpu-vsync");
24-
app.commandLine.appendSwitch("disable-software-rasterizer");
25-
// Force XWayland on Hyprland/Wayland — native Wayland is broken in Electron
26-
app.commandLine.appendSwitch("ozone-platform", "x11");
27-
app.commandLine.appendSwitch("ozone-platform-hint", "x11");
28-
process.env.ELECTRON_OZONE_PLATFORM_HINT = "x11";
29-
app.commandLine.appendSwitch("enable-features", "VaapiVideoDecodeLinuxGL");
22+
app.commandLine.appendSwitch("ozone-platform-hint", "auto");
3023
}
3124

3225
let mainWindow: BrowserWindow | null = null;
@@ -120,11 +113,8 @@ function createWindow(url: string): BrowserWindow {
120113
center: true,
121114
show: false,
122115
backgroundColor: "#0a0a0a",
123-
transparent: false,
124-
hasShadow: false,
125116
frame: true,
126117
titleBarStyle: "default",
127-
paintWhenInitiallyHidden: false,
128118
webPreferences: {
129119
preload: path.join(__dirname, "preload.js"),
130120
contextIsolation: true,
@@ -138,28 +128,13 @@ function createWindow(url: string): BrowserWindow {
138128

139129
win.loadURL(url);
140130

141-
const showWindow = () => {
142-
if (win.isDestroyed()) return;
143-
if (process.platform === "linux") {
144-
setTimeout(() => {
145-
if (!win.isDestroyed()) {
146-
win.show();
147-
win.focus();
148-
console.log("[Window] Ready and shown");
149-
}
150-
}, 250);
151-
} else {
131+
win.once("ready-to-show", () => {
132+
if (!win.isDestroyed()) {
152133
win.show();
153134
win.focus();
154135
console.log("[Window] Ready and shown");
155136
}
156-
};
157-
158-
if (process.platform === "linux") {
159-
win.webContents.once("did-finish-load", showWindow);
160-
} else {
161-
win.once("ready-to-show", showWindow);
162-
}
137+
});
163138

164139
if (isDev) {
165140
win.webContents.openDevTools();

0 commit comments

Comments
 (0)