'got wrong size of screen in electron and chrome
I want to get the real screen size to do sth in my electron app.
const { app, BrowserWindow } = require('electron')
let mainWindow = null
app.whenReady().then(() => {
// We cannot require the screen module until the app is ready.
const { screen } = require('electron')
// Create a window that fills the screen's available work area.
const primaryDisplay = screen.getPrimaryDisplay()
const { width, height } = primaryDisplay.bounds
mainWindow = new BrowserWindow({ width, height })
mainWindow.loadURL('https://electronjs.org')
})
But in my conputer,the resolution ratio is 1920x1080,scaling and system fontsize are both 100%.But the screen size I got was 1536x864,same as in chrome.
And I found that,when the system fontsize was zoom out,the real screen size got by screen object was smaller.
How can I get the real size of screen?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
