Can an electron app run one window across 2 monitors? I'm not able to drag the edge across to the other monitor. is this possible?
I know I can do this to access the second screen.
const electron = require('electron')
const {app, BrowserWindow} = require('electron')
let win
app.on('ready', () => {
let displays = electron.screen.getAllDisplays()
let externalDisplay = displays.find((display) => {
return display.bounds.x !== 0 || display.bounds.y !== 0
})
if (externalDisplay) {
win = new BrowserWindow({
x: externalDisplay.bounds.x + 50,
y: externalDisplay.bounds.y + 50
})
win.loadURL('https://github.com')
}
})
however, I dont want 2 windows just one across 2 displays.
You can drag the electron window like any other window.
If you want to set the window size, you either do it when a BrowserWindow is created or via BrowserWindow.setSize() to modify the size see BrowserWindow docs
That was real problem, that it was impossible to set via BrowserWindow.setSize() values gather than height and width of first screen, to open window stretched on few screens
But finally I have found, the solution is
BrowserWindow.setMinimumSize(W, H);
that allows to set width, like 10`000px, for few monitors, and it will be applied unlike setSize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With