Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
Apps that put a full-screen window on each display (presentation tools, kiosks, digital signage) need to choose the display for each window. Electron has no way to do that: win.setFullScreen(true) uses whatever display the window is on, and the usual workaround is to setBounds() the window onto the target display first.
On Wayland that workaround can't work: clients can't position their windows, and since 38.2 Electron runs natively on Wayland by default (#48833). The answer there was --ozone-platform=x11, but that is no longer an option either: some distributions no longer ship an X11 session (GNOME on Ubuntu 26.04 is Wayland only), and on our test machine (Dell laptop, Intel Iris Xe, Ubuntu 26.04) the app doesn't even paint through XWayland (XGetWindowAttributes failed, GPU process exiting with code 139). So on these desktops there is no workaround left.
What happens today: NativeWindowViews::SetFullScreen calls views::Widget::SetFullscreen(bool) with no display, so Chromium sends xdg_toplevel.set_fullscreen with a null output and the compositor decides. GNOME's Mutter puts a new window on the monitor under the mouse pointer, so a window meant for the projector often goes full screen on the laptop screen instead.
A minimal example, equivalent to what our app does:
const { app, BrowserWindow, screen } = require('electron')
app.whenReady().then(() => {
const primary = screen.getPrimaryDisplay()
const target = screen.getAllDisplays().find((d) => d.id !== primary.id)
const win = new BrowserWindow({ ...target.bounds, fullscreen: true })
win.loadURL('data:text/html,<h1>This should be on the second display</h1>')
})On Windows, macOS and X11 the window goes full screen on the second display. On a Wayland session it goes full screen wherever the compositor puts it (on GNOME, the display under the pointer).
Proposed Solution
Let setFullScreen take the display to use:
win.setFullScreen(true, { displayId: display.id })(and perhaps the same as a BrowserWindow constructor option), and pass it on to Chromium's existing views::Widget::SetFullscreen(bool fullscreen, int64_t target_display_id). On Wayland, Chromium already turns a target display into xdg_toplevel.set_fullscreen(output) with the matching wl_output (WaylandToplevelWindow::SetFullscreen). On Windows, macOS and X11, Electron could keep doing what apps do by hand today: move the window to the display's bounds, then go full screen.
Alternatives Considered
setBounds()to the target display, thensetFullScreen(true): works on Windows, macOS and X11; on Wayland the position is ignored.--ozone-platform=x11: not available on Wayland-only desktops, and on our machine the window doesn't paint through XWayland.element.requestFullscreen({ screen })(Window Management API): in Electron it only goes full screen on the current display ([Bug]: Multi-Screen Window Placement API not working #31103).- Checking where a window landed and moving or recreating it: on Wayland
getBounds()always starts at 0,0,getScreenDetails().currentScreenreported the primary display, and new windows go to the pointer's display again. - Asking users to move the window with the desktop's shortcut (Super+Shift+arrow on GNOME). This is what we document now, but it is no fix for an app whose users are on stage.
Additional Information
- Earlier request for the same API: [Feature Request]: Target a Display when fullscreen-ing a BrowserWindow #30249 (closed as not planned in May 2025, with "If you'd like to make a PR for this request we would welcome that"). Related: [Bug]: Can't position BrowserWindow onto 2nd display with Wayland #43493 (can't put a window on the second display under Wayland, closed as not planned) and Electron >= 38.2.0 ignores bounds and places all windows on the "active" screen. setBounds() doesn't work at all. #48833 (windows can't place themselves on Wayland since 38.2).
- What has changed since [Feature Request]: Target a Display when fullscreen-ing a BrowserWindow #30249: Wayland is now the default in Electron and the only session on some major distributions, so this went from an inconvenience to having no way at all to put a window on a given display.
- Our app: PDF Diva (https://github.com/nilovelez/pdf-diva), a presenter view for PDF files: the audience view full screen on the projector, the speaker view on another display. Seen with Electron 45.2.3 on Ubuntu 26.04 (GNOME, Wayland) with two displays.
Activity
docs: link the Electron feature request (electron/electron#55761)
docs: status: no reply yet on electron/electron#55761