Firefox kiosk mode on Sway black screen

I’m trying to run Firefox in kiosk mode (firefox --kiosk ) under Sway on NixOS 23.11 on bare-metal. Most of the time Firefox launches to a black screen. As a test I launched Firefox 25 times, and it only showed a non-black window 3 times.

Using Sway commands, such as toggle fullscreen (default super+f) or switching to a different workspace and back “fixes” the issue. Firefox commands such as Reload (ctrl+r) or New Tab (ctrl+t) do nothing.

Launching Firefox normally (aka, firefox ) works every time.

If I force Firefox to use X (MOZ_ENABLE_WAYLAND=0 firefox --kiosk ) it works.

On the same hardware if I boot into an Arch Linux 2024.01 ISO and install sway+firefox+polkit+foot and re-run the same test, kiosk mode seems to work every time.

In both cases I checked about:support and Window Protocol is Wayland on both NixOS and Arch.

My hardware is a Dell Optiplex 7060, which has Intel UHD 630 graphics.

I’ve spent the last few hours trying to narrow this down because there is so many moving pieces. A mis-config? Is it a Firefox bug? A Sway bug? Something in Nix’s wrapper around Firefox that changes things? …

Open to suggestions!

I am able to reproduce this bug on archlinux KDE Wayland session, but ir does not work with and without wayland.

It sometimes works and sometimes it doesn’t:

user@arch ~ $ MOZ_ENABLE_WAYLAND=0 firefox --kiosk 
[Parent 22451, Main Thread] WARNING: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed: 'glib warning', file /build/firefox/src/firefox-122.0/toolkit/xre/nsSigHandlers.cpp:187

(firefox:22451): Gdk-CRITICAL **: 20:04:29.199: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed
^CExiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.

user@arch ~ $ MOZ_ENABLE_WAYLAND=0 firefox --kiosk 
[Parent 22727, Main Thread] WARNING: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed: 'glib warning', file /build/firefox/src/firefox-122.0/toolkit/xre/nsSigHandlers.cpp:187

(firefox:22727): Gdk-CRITICAL **: 20:04:40.800: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed
^CExiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.

user@arch ~ $ firefox --kiosk  
[Parent 23014, Main Thread] WARNING: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed: 'glib warning', file /build/firefox/src/firefox-122.0/toolkit/xre/nsSigHandlers.cpp:187

(firefox:23014): Gdk-CRITICAL **: 20:05:38.098: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed
^CExiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.

user@arch ~ $ MOZ_ENABLE_WAYLAND=0 firefox --kiosk 
user@arch ~ $ MOZ_ENABLE_WAYLAND=0 firefox --kiosk 
[Parent 23623, Main Thread] WARNING: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed: 'glib warning', file /build/firefox/src/firefox-122.0/toolkit/xre/nsSigHandlers.cpp:187

(firefox:23623): Gdk-CRITICAL **: 20:06:17.588: gdk_window_get_position: assertion 'GDK_IS_WINDOW (window)' failed
^CExiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.

user@arch ~ $ firefox --kiosk
[works]
1 Like