* fix full screen size issue on windows * createWindow() reuse param is not used
This commit is contained in:
14
src/main.ts
14
src/main.ts
@ -102,13 +102,9 @@ if (!singleInstanceLock && !IS_PLAYWRIGHT) {
|
|||||||
registerStartupListeners()
|
registerStartupListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
const createWindow = (pathToOpen?: string, reuse?: boolean): BrowserWindow => {
|
const createWindow = (pathToOpen?: string): BrowserWindow => {
|
||||||
let newWindow: BrowserWindow | null = null
|
let newWindow: BrowserWindow | null = null
|
||||||
|
|
||||||
if (reuse) {
|
|
||||||
newWindow = mainWindow
|
|
||||||
Menu.setApplicationMenu(null)
|
|
||||||
}
|
|
||||||
if (!newWindow) {
|
if (!newWindow) {
|
||||||
const primaryDisplay = screen.getPrimaryDisplay()
|
const primaryDisplay = screen.getPrimaryDisplay()
|
||||||
const { width, height } = primaryDisplay.workAreaSize
|
const { width, height } = primaryDisplay.workAreaSize
|
||||||
@ -154,6 +150,10 @@ const createWindow = (pathToOpen?: string, reuse?: boolean): BrowserWindow => {
|
|||||||
titleBarStyle: 'hiddenInset',
|
titleBarStyle: 'hiddenInset',
|
||||||
backgroundColor: nativeTheme.shouldUseDarkColors ? '#1C1C1C' : '#FCFCFC',
|
backgroundColor: nativeTheme.shouldUseDarkColors ? '#1C1C1C' : '#FCFCFC',
|
||||||
})
|
})
|
||||||
|
// This is only needed on windows, but it doesn't do any harm on other platforms.
|
||||||
|
// On windows the initial width, height supplied above cannot be larger than screen resolution which causes
|
||||||
|
// some weird border to appear when the last window size was close to full screen.
|
||||||
|
newWindow.setBounds({ x, y, width: windowWidth, height: windowHeight })
|
||||||
}
|
}
|
||||||
|
|
||||||
newWindow.on('close', () => {
|
newWindow.on('close', () => {
|
||||||
@ -239,9 +239,7 @@ const createWindow = (pathToOpen?: string, reuse?: boolean): BrowserWindow => {
|
|||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
// mainWindow.webContents.openDevTools()
|
// mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
if (!reuse) {
|
if (!process.env.HEADLESS) newWindow.show()
|
||||||
if (!process.env.HEADLESS) newWindow.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
return newWindow
|
return newWindow
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user