Electron : Create a window above all the others (e

2019-02-19 16:08发布

问题:

As the title of my question may be sufficiently understandable, I'll explain anyway.

I'm working on a personal project with Electron, and I'm facing a frustrating issue which is :

I'd like to create a small window (50x50 px) which would be above every other window, even when those are fullscreen. I mean, even if I'm on Youtube with Chrome and I enter fullscreen, my window would stay on top of it.

Basically, I've succeeded in making my window above all the others, a simple setAlwaysOnTop(true) did the trick. However, the taskbar in Windows keeps showing, but if I hide my window or just close it, the taskbar disappears and everything's fine.

So my question is : How can I achieve to have a window above all the others, including fullscreen ones, which wouldn't make the taskbar visible ? (in my sense, the taskbar kills the fullscreen end-user experience).

Details : my window has transparency enabled, and both kiosk mode and fullscreen mode are not needed since I only use 50x50 px.

Thank you for your help.

回答1:

Well, I fixed the issue by doing this :

window = new BrowserWindow({ ...  type:'toolbar' ... });`

This makes the window act exactly as the Skype Window when you're on call : It's always on top, even when you're in fullscreen browser and the taskbar won't show unless you focus explicitly your window.

Remark : Your window won't be on top of programs such as video games (League of Legends, Dota, aso.) because they usually manipulate the graphical rendering so that you can't go on top of em.

Hope this will help !