問題描述
由于我的問題的標題可能很容易理解,我還是會解釋一下.
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:在所有其他窗口之上創建一個窗口(甚至全屏)并隱藏任務欄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!