Skip to content

fix(linux): avoid Wayland kMinimized FATAL on tray show (#3397) - #3594

Open
ncfoster219 wants to merge 1 commit into
crowbartools:v5from
ncfoster219:cursor/wayland-minimize-crash-6867
Open

ncfoster219 wants to merge 1 commit into
crowbartools:v5from
ncfoster219:cursor/wayland-minimize-crash-6867

Conversation

@ncfoster219

Copy link
Copy Markdown

Description of the Change

On Linux Wayland (Electron 38.2+ / 39.x), Firebot’s minimize-to-tray path leaves the BrowserWindow in Chromium’s kMinimized state while hidden, then calls show() from the tray. That triggers a Chromium Ozone FATAL:

FATAL:…wayland_toplevel_window.cc:791] Should not be called with kMinimized state → SIGTRAP.

This matches electron/electron#49253 (fixed upstream only in Electron 43+ via Chromium 149). Firebot ships Electron 39.8.10.

App-side workaround (this PR):

  1. On minimize-to-tray: restore() then hide() (deferred) so the window is not left minimized while hidden.
  2. Shared revealMainWindow(): always restore() before show() for tray Show / double-click / focus.
  3. Same restore-before-show order in second-instance.ts.

Also adds scripts/wayland-minimize-repro.js to reproduce crash vs fixed path with the bundled Electron.

Applicable Issues

Testing

On Ubuntu 26.04 / KDE Plasma Wayland (XDG_SESSION_TYPE=wayland), Electron 39.8.10 from this repo:

Crash path (unfixed pattern):

./node_modules/.bin/electron scripts/wayland-minimize-repro.js

→ exact FATAL at wayland_toplevel_window.cc:791

Fixed path:

./node_modules/.bin/electron scripts/wayland-minimize-repro.js --fixed

→ survives, exits 0

Full Firebot grunt prep hits a local Vite/rolldown Node engine mismatch on this machine (Node 22.11 < required 22.12); TypeScript compile of the tray change succeeded. Recommend smoke: enable Settings → Minimize to Tray, minimize, tray Show, repeat on Wayland.

Screenshots

N/A (main-process tray behavior)

…#3397)

Electron 38.2+/39 on native Wayland hits Chromium
wayland_toplevel_window.cc FATAL when show() runs while the
BrowserWindow is still minimized (minimize-to-tray hide path).

Restore before hide on minimize-to-tray, and restore before show
from tray / second-instance. Adds a small electron repro script.
@ncfoster219
ncfoster219 requested a review from ebiggz as a code owner November 26, 2026 11:02
@itsjesski

Copy link
Copy Markdown
Collaborator

Has this been tested on anything other than wayland yet just to be sure we're not breaking things for other people?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants