diff --git a/js/notify/settings/configure-notification-position.js b/js/notify/settings/configure-notification-position.js index 05b10fcc..e809210f 100644 --- a/js/notify/settings/configure-notification-position.js +++ b/js/notify/settings/configure-notification-position.js @@ -75,13 +75,30 @@ function getTemplatePath() { * @param windowName */ function openConfigurationWindow(windowName) { - let allWindows = BrowserWindow.getAllWindows(); - allWindows = allWindows.find((window) => { return window.winName === windowName }); + const allWindows = BrowserWindow.getAllWindows(); + const selectedParentWindow = allWindows.find((window) => { return window.winName === windowName }); // if we couldn't find any window matching the window name // it will render as a new window - if (allWindows) { - windowConfig.parent = allWindows; + if (selectedParentWindow) { + windowConfig.parent = selectedParentWindow; + + /** + * This is a temporary work around until there + * is a fix for the modal window in windows from the electron + * issue - https://github.com/electron/electron/issues/10721 + */ + const { x, y, width, height } = selectedParentWindow.getBounds(); + + const windowWidth = Math.round(width * 0.5); + const windowHeight = Math.round(height * 0.5); + + // Calculating the center of the parent window + // to place the configuration window + const centerX = x + width / 2.0; + const centerY = y + height / 2.0; + windowConfig.x = Math.round(centerX - (windowWidth / 2.0)); + windowConfig.y = Math.round(centerY - (windowHeight / 2.0)); } configurationWindow = new BrowserWindow(windowConfig);