ELECTRON-955 fixing toast notification does not show on top of the Electron after it is minimized and maximized again (#534)

This commit is contained in:
VICTOR RAPHAEL BRAGA DE SALES MASCARENHAS 2018-12-19 02:13:58 -02:00 committed by Vishwas Shashidhar
parent 3850bc9b2f
commit 8ca8db65ed

View File

@ -121,6 +121,25 @@ function createMainWindow(initialUrl) {
});
}
/**
* ELECTRON-955: Always on Top - Toast notification does not show on top (front) of the Electron app after it is minimized and maximized again
* Bring to front all notification windows
*/
function bringToFrontNotification() {
if (mainWindow && !mainWindow.isDestroyed()) {
let allBrowserWindows = BrowserWindow.getAllWindows();
const notificationWindow = allBrowserWindows.filter((item) => item.winName === 'notification-window');
if (mainWindow.isAlwaysOnTop()) {
notificationWindow.forEach((item) => {
if (item && !item.isDestroyed()) {
item.setAlwaysOnTop(true);
}
});
}
}
}
/**
* Creates the main window with bounds
* @param initialUrl
@ -758,6 +777,7 @@ function saveMainWinBounds() {
if (mainWindow && !mainWindow.isDestroyed()) {
newBounds.isMaximized = mainWindow.isMaximized();
newBounds.isFullScreen = mainWindow.isFullScreen();
bringToFrontNotification();
}
if (newBounds) {