Maximize main window if monitor removed/changed resolution (#2486)
* Maximize main window if monitor removed/changed resolution * Fix unit tests * Add better handlers to support active screen changes
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {app, ipcMain, session} from 'electron';
|
||||
import {app, ipcMain, screen, session} from 'electron';
|
||||
import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-devtools-installer';
|
||||
import isDev from 'electron-is-dev';
|
||||
import log from 'electron-log';
|
||||
@@ -119,6 +119,8 @@ export async function initialize() {
|
||||
app.whenReady(),
|
||||
]);
|
||||
|
||||
initializeScreenEventListeners();
|
||||
|
||||
// no need to continue initializing if app is quitting
|
||||
if (global.willAppQuit) {
|
||||
return;
|
||||
@@ -188,6 +190,11 @@ function initializeAppEventListeners() {
|
||||
app.on('will-finish-launching', handleAppWillFinishLaunching);
|
||||
}
|
||||
|
||||
function initializeScreenEventListeners() {
|
||||
screen.on('display-removed', WindowManager.displayRemoved);
|
||||
screen.on('display-metrics-changed', WindowManager.displayMetricsChanged);
|
||||
}
|
||||
|
||||
function initializeBeforeAppReady() {
|
||||
if (!Config.data) {
|
||||
log.error('No config loaded');
|
||||
|
Reference in New Issue
Block a user