Hi,
I have an application that uses the always on top mode, which is user selectable.
Some of our users need it to be in front on all windows. This has stopped working after an upgrade.
What we are doing:
The Browser window is being initialized this way:
mainWindow = new BrowserWindow({
resizable: false,
frame: false,
fullscreenable: false,
alwaysOnTop: true,
x: screenWidth - width,
y: screenHeight - height,
width,
height,
webPreferences: {
nodeIntegration: 'true or false, depending on the environment',
preload: path.join(__dirname, 'preload.js'),
blinkFeatures: 'OnDeviceChange'
}
})
Then, we allow the user to toggle always on top:
setAlwaysOnTop (alwaysOnTop) {
const platform = __REMOTE__.system.getPlatform()
const level = platform === 'darwin' ? 'floating' : 'screen-saver' // for Windows only.
mainWindow.setAlwaysOnTop(alwaysOnTop, level)
}
With this configuration, I was able to keep the application above all windows.
However, users started complaining that it wasn’t always true. For example, the application can no longer stay on top of other ones, such as Remote Desktop. This is happening, so far, only in Windows 10.
This problem started when we upgraded from Electron 6.1.11 to Electron 8.5.3.
Before, it would stay on top and we confirmed that with an older application version.
The snippet above was the first fix we did, which solved the problem for some users, but not for everyone. For example, there is another application called TightVNC which would jump in front of ours and no longer does.
Before the upgrade, the level wasn’t even being set:
setAlwaysOnTop (alwaysOnTop) {
mainWindow.setAlwaysOnTop(alwaysOnTop)
}
I couldn’t find anything relevant on the release notes.
Is this a known issue? Am I doing something wrong? How can I force the application to be always on top of others, like it did before?
Thanks!