Skip to content

Electron needs explicit ozone platform hints to work with wayland in multiple monitors #46843

Open
@khaosdoctor

Description

@khaosdoctor

Preflight Checklist

Electron Version

34

What operating system(s) are you using?

Other Linux

Operating System Version

6.14.4-arch1-1

What arch are you using?

x64

Last Known Working Electron version

As far as I tested, this is happening up until v28

Expected Behavior

The applications work in all the monitors normally

Actual Behavior

I currently have two monitors set up like this in Sway:

# Focus first monitor on start
focus output DP-1

# OLED Monitor (4K) in the center
output DP-1 {
    mode 3840x2160@240Hz
    position 0 0
    scale 1.25
}

# portrait second monitor (UHD 2560x1440) on the left side
output DP-2 transform 90 {
    mode 1440x2560@165Hz
    # 3840 at a 1.25 scale is 3840 / 1.25 = 3072
    # For the Y it was trial and error
    # Left side (transform 90)
    position -1440 -450
}

There's a weird bug happening where, if I open the application on the main monitor (the OLED) it will work normally, if I move the application to the secondary monitor, it doesn't receive any other keyboard or mouse inputs anymore, essentially, it becomes an image.

To make it work again, I need to set ELECTRON_OZONE_PLATFORM_HINT=auto (or wayland) before running the apps, but then this triggers #46823. To reproduce it, I didn't have to do much, the default application from the fiddle already shows the problem: https://gist.github.com/khaosdoctor/145dd3db00b2b4d1fb78f51b9c14b5b9

I added a button, if you have two monitors (I'm not sure if the different DPI will affect it) the second monitor won't have any interaction with it, the application will seem dead, however, it works normally on the main monitor.

Testcase Gist URL

https://gist.github.com/khaosdoctor/145dd3db00b2b4d1fb78f51b9c14b5b9

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    👀 Unsorted Items

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions