Niri/xwayland-satellite: Black steam window fix

The Issue

I had this issue with niri, where the main steam window would just be a black rectangle but the popup at the beginning still worked.


I tracked the error down to a lot of BadWindow errors being returned by the X server:
X Error of failed request: BadWindow (invalid Window parameter)

The Fix

One solution is disabling hardware acceleration using -cef-disable-gpu, but that’s suboptimal.
The best solution I was able to find is disabling gpu composition using -cef-disable-gpu-compositing.
Like that you can keep hardware acceleration.

Nix Overlay

Here is the overlay I wrote that fixes this:

  # Disable x11 window composition to avoid race condition when using xwayland-satellite
  nixpkgs.overlays = [
    (final: prev: {
      steam = prev.steam.override {
        extraArgs = "-cef-disable-gpu-compositing";
      };
    })   
  ];
  
  # then just enable steam as normal
  programs.steam = {
    enable = true;
    protontricks.enable = true;
  };

The Cause (speculation)

I’m not sure on the exact mechanism, but I think it’s something along these lines:

The Steam GUI works like this:

  • The main process spawns the top-level X11 window
  • The CEF process then creates a hardware-accelerated child window tied to the main Window

What I assume might be happening is that the CEF process is trying to access the main window before it was fully “instantiated” by wayland-satellite. So the X server returns BadWindow as the requested window doesn’t exist (yet).

Why this fixes it

By disabling X11 composition, no child window is created, meaning no race condition happens either.

5 Likes