问题描述
我目前正在开发一个电子托盘应用程序.对于 Mac,electron 框架具有将应用程序隐藏在 Dock 中的功能.
I currently working on an electron tray application. For Mac, the electron framework has a function for hiding the app in the dock.
app.dock.hide();
我尝试在 Windows 机器上运行它并得到一个错误.
I try to run this on a Windows machine and get an error.
TypeError: Cannot read property 'hide' of undefined
现在我正在为 Windows 寻找一个等效的功能来隐藏任务栏中的应用程序.
Now I am looking for an equivalent functionality for Windows to hide the app in the taskbar.
推荐答案
Mac OS X 是面向应用程序的,而 Windows 是面向窗口的...
Mac OS X is application-oriented, whereas Windows is window-oriented...
app.dock.hide ()
确实只标记为 macOS.
app.dock.hide ()
Is indeed tagged as macOS only.
为了使窗口不显示在任务栏中,您可以调用:
In order to make the window not show in the taskbar, you can either call:
win.setSkipTaskbar (true);
或者将 skipTaskbar
添加到传递给新 BrowserWindow 的选项中:
Or add skipTaskbar
to the options passed to the new BrowserWindow:
{
// ...
skipTaskbar: true,
// ...
}
这篇关于app.dock.hide() 的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!