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 bug report that matches the one I want to file, without success.
Electron Version
32.0.1
What operating system(s) are you using?
Ubuntu, Other Linux
Operating System Version
Raspbian Debian Bookworm v12
What arch are you using?
Other (specify below)
Last Known Working Electron version
No response
Expected Behavior
With two displays I expect to be able to create a BrowserWindow with an (x, y) position that places the window on the 2nd display. This works as expected on MacOS and presumably other OSes but not on a Raspberry Pi running Bookworm, which uses Wayland, by default, instead of X11. Maybe be related to #40886. Switching Bookworm to X11 solves the problem.
Actual Behavior
Setting (x,y) coordinates in the new BrowserWindow arguments does one of three things, depending upon the window width/height and x/y. Either:
- positions the window as expected on the active display
- positions the window so that one or more edges (right and/or bottom) of the window are located at the edge of the active display
- positions the window at the top left (roughly 0,0, but with about 10 pixels of margin) of the active display
There is no way to get a window onto the 2nd display.
Replicated in attached gist or using the code from https://github.com/electron/electron-quick-start, just adding x and y properties in main.js:
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
x: 1024,
y: 1152,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
Combinations tested from the display with width: 2048, height: 1152. I can't make sense of this. What I want is 800x600 at 1024, 1152 because that would place the window on the 2nd display, fullscreen. What really confuses be is when the x,y numbers get big, the window stops going to top left and ends up at the lower right corner.
- {width: 800, height: 600, x: 125, y: 153} - positioned as expected
- {width: 800, height: 600, x: 1023, y: 1151} - top left
- {width: 800, height: 600, x: 1024, y: 1152} - top left
- {width: 800, height: 600, x: 1025, y: 1153} - top left
- {width: 750, height: 550, x: 1025, y: 1153} - top left
- {width: 400, height: 300, x: 1023, y: 1151} - top left
- {width: 750, height: 550, x: 1525, y: 1653} - right edge roughly mid screen, bottom of window on bottom of active display
- {width: 800, height: 600, x: 2025, y: 2153} - lower right (bottom and right of window along edge of active display)
- {width: 800, height: 600, x: 525, y: 553} - right edge roughly mid screen, bottom of window on bottom of active display
Display information from my pi is shown below. Note that the 2nd display is positioned at (1024, 1152) and is also visible in screen layout on screenshot above.
[
{
accelerometerSupport: 'unknown',
bounds: { x: 1024, y: 1152, width: 1024, height: 768 },
colorDepth: 24,
colorSpace: '{primaries:BT709, transfer:SRGB, matrix:RGB, range:FULL}',
depthPerComponent: 8,
detected: true,
displayFrequency: 74.89952850341797,
id: 33,
internal: false,
label: '',
maximumCursorSize: { width: 0, height: 0 },
monochrome: false,
nativeOrigin: { x: 1024, y: 1152 },
rotation: 0,
scaleFactor: 1,
size: { width: 1024, height: 768 },
workArea: { x: 1024, y: 1152, width: 1024, height: 768 },
workAreaSize: { width: 1024, height: 768 },
touchSupport: 'unknown'
},
{
accelerometerSupport: 'unknown',
bounds: { x: 0, y: 0, width: 2048, height: 1152 },
colorDepth: 24,
colorSpace: '{primaries:BT709, transfer:SRGB, matrix:RGB, range:FULL}',
depthPerComponent: 8,
detected: true,
displayFrequency: 59.82716369628906,
id: 35,
internal: false,
label: '',
maximumCursorSize: { width: 0, height: 0 },
monochrome: false,
nativeOrigin: { x: 0, y: 0 },
rotation: 0,
scaleFactor: 1,
size: { width: 2048, height: 1152 },
workArea: { x: 0, y: 0, width: 2048, height: 1152 },
workAreaSize: { width: 2048, height: 1152 },
touchSupport: 'unknown'
}
]
Testcase Gist URL
Additional Information
Architecture = ARMV71
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields👍 Does Not Block Stable
- StatusShow more project fields👍 Does Not Block Stable
Activity
electron-issue-triage commentedon Dec 4, 2024
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
electron-issue-triage commentedon Jan 4, 2025
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.