Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Open BrowserWindow on secondary screen on MAc #42217

Open
3 tasks done
NykoKar opened this issue May 17, 2024 · 3 comments
Open
3 tasks done

[Bug]: Open BrowserWindow on secondary screen on MAc #42217

NykoKar opened this issue May 17, 2024 · 3 comments
Labels
30-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ status/reviewed A maintainer made an initial review but not reproduced the issue

Comments

@NykoKar
Copy link

NykoKar commented May 17, 2024

Preflight Checklist

Electron Version

30.0.6

What operating system are you using?

macOS

Operating System Version

MasOS Somona 14.4.1 - M1

What arch are you using?

Other (specify below)

Last Known Working Electron version

No response

Expected Behavior

Create a BrowserWindow on my secondary screen near main screen

Actual Behavior

The BrowserWindow is created on the main screen.

Testcase Gist URL

https://gist.github.com/NykoKar/f3f8e7eaec0e980d42d53c1b050e378b

Additional Information

I followed this documentation: https://www.electronjs.org/docs/latest/api/screen
It works on Windows but not on MacOS.

@electron-issue-triage electron-issue-triage bot added 30-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels May 17, 2024
@NykoKar
Copy link
Author

NykoKar commented May 17, 2024

A better gist (to test on Fiddle for example): https://gist.github.com/NykoKar/002b79bdaed2bf36ab8f9bc30dbefec3

@clavin
Copy link
Member

clavin commented May 21, 2024

I'm sorry, I'm unable to reproduce this issue given the test case provided on macOS. I checked my display settings and the displays reported by screen.getAllDisplays() and everything seems to be working properly.

Check out the Electron community. There are also a bunch of helpful people in this Discord that should be willing to point you in the right direction. For your question, I'd recommend the Discord - we have many active help channels and mentors, as well as fellow devs, who can help you out.

@clavin clavin closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
@NykoKar
Copy link
Author

NykoKar commented May 22, 2024

@clavin
Thank you for your feedback but I'm not sure you understand my issue (because I really think there is one) so I'll try to explain it better.

I have two screens next to each other (main in front of me, secondary on my right) and the function screen.getAllDisplays() also give me the right values:

[
  {
    id: 2,
    label: 'DELL U2720Q',
    bounds: { x: 0, y: 0, width: 3008, height: 1692 },
    workArea: { x: 0, y: 25, width: 3008, height: 1667 },
    accelerometerSupport: 'unknown',
    monochrome: false,
    colorDepth: 24,
    colorSpace: '{primaries:BT709, transfer:SRGB, matrix:RGB, range:FULL}',
    depthPerComponent: 8,
    size: { width: 3008, height: 1692 },
    displayFrequency: 59,
    workAreaSize: { width: 3008, height: 1667 },
    scaleFactor: 2,
    rotation: 0,
    internal: false,
    touchSupport: 'unknown'
  },
  {
    id: 1,
    label: 'VG248',
    bounds: { x: 3008, y: 0, width: 1920, height: 1080 },
    workArea: { x: 3008, y: 25, width: 1920, height: 1055 },
    accelerometerSupport: 'unknown',
    monochrome: false,
    colorDepth: 24,
    colorSpace: '{r:[0.6502, 0.3292], g:[0.3301, 0.6229], b:[0.1513, 0.3292], w:[0.3127, 0.3290]}, transfer:BT709_APPLE, matrix:RGB, range:FULL}',
    depthPerComponent: 8,
    size: { width: 1920, height: 1080 },
    displayFrequency: 60,
    workAreaSize: { width: 1920, height: 1055 },
    scaleFactor: 1,
    rotation: 0,
    internal: false,
    touchSupport: 'unknown'
  }
]

So the second monitor, which is the VG248, has

bounds: { x: 3008, y: 0, width: 1920, height: 1080 },

So, to create a BrowserWindow on this monitor, I put these parameters on the constructor (x & y + 50 as indicated on electron's documentation ):
new BrowserWindow({ x: 3008 + 50, y: 0 + 50, })

On my side, this BrowserWindow will be created on my primary screen whereas it should be displayed on my secondary as I have put coordinate of my secondary monitor.

Additional information: I'm working on a mac mini. So, maybe there is a difference of behaviour between macbook with 1 external screen and mac mini with 2 external screens, just an idea.

@clavin clavin reopened this May 22, 2024
@clavin clavin added bug 🪲 status/reviewed A maintainer made an initial review but not reproduced the issue 30-x-y and removed discussion labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ status/reviewed A maintainer made an initial review but not reproduced the issue
Projects
Status: 👀 Unsorted Items
Development

No branches or pull requests

2 participants