Electron:在所有其他窗口之上创建一个窗口(甚至全屏)并隐藏任务栏

时间:2023-01-28
本文介绍了Electron:在所有其他窗口之上创建一个窗口(甚至全屏)并隐藏任务栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

由于我的问题的标题可能很容易理解,我还是会解释一下.

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

我正在使用 Electron 进行个人项目,但我面临一个令人沮丧的问题:

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

我想创建一个小窗口(50x50 像素),它会在所有其他窗口上方,即使它们是全屏的.我的意思是,即使我在 Youtube 上使用 Chrome 并进入全屏模式,我的窗口也会停留在上面.

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.

基本上,我已经成功地将我的窗口置于所有其他窗口之上,一个简单的 setAlwaysOnTop(true) 就可以了.但是,Windows 中的任务栏一直显示,但如果我隐藏我的窗口或只是关闭它,任务栏就会消失,一切都很好.

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).

详细信息:我的窗口启用了透明度,不需要信息亭模式和全屏模式,因为我只使用 50x50 像素.

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

感谢您的帮助.

推荐答案

好吧,我通过这样做解决了这个问题:

Well, I fixed the issue by doing this :

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

当您在通话时,这使得窗口与 Skype 窗口完全一样:它始终位于顶部,即使您在全屏浏览器中并且任务栏不会显示,除非您明确关注您的窗口.

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.

备注:您的窗口不会位于诸如视频游戏(英雄联盟、Dota 等)之类的程序之上,因为它们通常会操纵图形渲染,因此您无法进入它们之上.

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.

希望这会有所帮助!

这篇关于Electron:在所有其他窗口之上创建一个窗口(甚至全屏)并隐藏任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:最小示例:从反应应用程序中打开电子窗口? 下一篇:Electron 无法正确安装,请删除 node_modules/并尝试重新安装

相关文章

最新文章