mawie81 / electron-window-state

A library to store and restore window sizes and positions for your Electron app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'screen' of undefined

Feverqwe opened this issue · comments

commented

In main process variable electron.screen sometimes is null on mac.
At this line you try get screen from remote, that is undefined.

var screen = electron.screen || electron.remote.screen;

I also have this in mac, in my case in the built app (using "electron-builder": "19.10.0"). It seems to only happen the first time I try to open the app. After that it works.

I just noticed that this error occurs when opening the application multiple times subsequently on two monitors. As soon as I launch the app successfully on a single monitor, I can reconnect my second monitor and relaunch the app successfully. As with the previous two reports, this is on OS X, resolved "https://registry.yarnpkg.com/electron-window-state/-/electron-window-state-4.1.1.tgz#6b34fdc31b38514dfec8b7c8f7b5d4addb67632d".

I haven't tried to figure out deleting what build files / runtime files / caches make the bug recur.