Fix window creation failures on Mac (most noteable in CI) (#5809)
Allow window to be larger than screen on mac as well, fixing tests
This commit is contained in:
11
src/main.ts
11
src/main.ts
@ -58,7 +58,6 @@ console.log('Environment vars', process.env)
|
||||
console.log('Parsed CLI args', args)
|
||||
|
||||
/// Register our application to handle all "zoo-studio:" protocols.
|
||||
const singleInstanceLock = app.requestSingleInstanceLock()
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient(ZOO_STUDIO_PROTOCOL, process.execPath, [
|
||||
@ -73,8 +72,11 @@ if (process.defaultApp) {
|
||||
// Must be done before ready event.
|
||||
// Checking against this lock is needed for Windows and Linux, see
|
||||
// https://www.electronjs.org/docs/latest/tutorial/launch-app-from-url-in-another-app#windows-and-linux-code
|
||||
if (!singleInstanceLock && !IS_PLAYWRIGHT) {
|
||||
app.quit()
|
||||
if (!IS_PLAYWRIGHT) {
|
||||
const singleInstanceLock = app.requestSingleInstanceLock()
|
||||
if (!singleInstanceLock) {
|
||||
app.quit()
|
||||
}
|
||||
} else {
|
||||
registerStartupListeners()
|
||||
}
|
||||
@ -89,6 +91,7 @@ const createWindow = (pathToOpen?: string, reuse?: boolean): BrowserWindow => {
|
||||
newWindow = new BrowserWindow({
|
||||
autoHideMenuBar: false,
|
||||
show: false,
|
||||
enableLargerThanScreen: true,
|
||||
width: 1800,
|
||||
height: 1200,
|
||||
webPreferences: {
|
||||
@ -197,6 +200,8 @@ app.on('window-all-closed', () => {
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', (event, data) => {
|
||||
// Avoid potentially 2 ready fires
|
||||
if (mainWindow) return
|
||||
// Create the mainWindow
|
||||
mainWindow = createWindow()
|
||||
})
|
||||
|
Reference in New Issue
Block a user