electron/docs/fiddles/screen/fit-screen/main.js

18 lines
549 B
JavaScript
Raw Normal View History

// Retrieve information about screen size, displays, cursor position, etc.
//
// For more info, see:
2023-08-10 09:55:52 +00:00
// https://www.electronjs.org/docs/latest/api/screen
const { app, BrowserWindow, screen } = require('electron/main')
let mainWindow = null
app.whenReady().then(() => {
// Create a window that fills the screen's available work area.
const primaryDisplay = screen.getPrimaryDisplay()
const { width, height } = primaryDisplay.workAreaSize
mainWindow = new BrowserWindow({ width, height })
mainWindow.loadURL('https://electronjs.org')
})