Skip to content

Electron >= 38.2.0 ignores bounds and places all windows on the "active" screen. setBounds() doesn't work at all. #48833

Closed as not planned

Description

@valueerrorx

Preflight Checklist

Electron Version

38.2.0 +

What operating system(s) are you using?

Other (specify below)

Operating System Version

Arch Linux 6.17.6-zen1-1-zen kwin 6.5.1-1

What arch are you using?

x64

Last Known Working Electron version

38.1.2

Does the issue also appear in Chromium / Google Chrome?

I don't know how to test

Expected Behavior

providing x and y coordinates should place the electron window at the specific coordinates. so should setBounds()

win = new BrowserWindow({
        title: "test",
    
        width: 800,,
        height: 600,
        x: 200,
        y: 200,
    })
win.loadFile('index.html') 

should position the window on the first screen at 200,200

win.setBounds({ x: 200, y: 200, width: 800, height: 600 })

also should position the window on the first screen at 200,200

Actual Behavior

neither is working since version 38.2.x
with the new versions the electron window is always placed at the active screen (where the mouse cursor resides) in the center.. always centered!

i am using a simple dualscreen setup (primary extended with secondary east)
i have testet electron 38.2 - 40.0.0-alpha.2 - none of them is positiononing the window correctly on kde plasma/wayland

Testcase Gist URL

No response

Additional Information

No response

Activity

  1. added theissue type on Nov 7, 2025
  2. mitchchn commented on Nov 7, 2025

    @mitchchn
    Member

    Electron runs in native Wayland mode by default in 38.2, and windows cannot position themselves programmatically on Wayland. Please review: https://www.electronjs.org/docs/latest/api/browser-window#platform-notices.

  3. valueerrorx commented on Nov 7, 2025

    @valueerrorx
    Author

    i was afraid so...
    unfortunately using ozone-platform x11 isn't a reliable option either...

    so this is not a bug - it's a wayland "feature" 👎

    the linked platform-notices state that even focus and blur aren't available anymore withou user-input. that's really bad because i heavily rely on those features for a kiosk-like application (which is already hard to implement on multiscreen setups)

    does that mean that if i would ask the user if he would like to trigger a bunch of actions like setBounds() and this is triggered right after the user klicks on ok.. would itl work?

  4. mitchchn commented on Nov 7, 2025

    @mitchchn
    Member

    Yeah it's rough. :)

    It it helps, using ozone-platform=x11 will make all these features work exactly as they did in 38.1. The only difference in 38.2 is the default value of that flag. I understand it sucks to be stuck in X11 mode, but it's how your app and others were working until now, and there's no reason to expect it to stop working any time soon.

    does that mean that if i would ask the user if he would like to trigger a bunch of actions like setBounds() and this is triggered right after the user klicks on ok.. would itl work?

    This is an interesting question. The docs for xdg_toplevel_move say:

    This request must be used in response to some sort of user action like a button press, key press, or touch down event. The passed serial is used to determine the type of interactive move (touch, pointer, etc).

    https://wayland.app/protocols/xdg-shell#xdg_toplevel:request:move

    So in principle, it is possible to initiate a move request from a mouse click callback. I do know if this would actually work in practice, or if it would be possible to wire it up across the renderer process in Electron. And even in the best case you would not be able to chain multiple actions or delay handling. Wayland really does try to enforce the user input requirement.

    The proposed Zones extension might make this better in the future, but it's still a ways out: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/264.

    Since you said you are making a kiosk app, another approach you could take is to create a fullscreen window (even a transparent one). Then you can position both web content and views within that window any way you'd like. You'd basically be building your own mini window manager inside of a window.

    (Might sound silly but it's actually what Wayland devs recommend and it's not too dissimilar to how GTK apps draw their own window frames on Wayland.)

  5. nikwen commented on Nov 7, 2025

    @nikwen
    Member

    Thanks for replying here, @mitchchn! I'll close the issue given that there is nothing we can do about it.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions