Close window by taskbar but the window will not show again while clicking the tray icon


Currently I am using Electron to develop a desktop app.Here there is a taskbar icon and a tray icon for my app.If I right click the taskbar icon and chose to close the window(seems like a native feature of the Window system),it is some kind of my app’s main window is closed(or destroy).But still there is the tray icon that doesn’t show the main window when I click it.Please help!


Currently there is no answer


Please post your tray icon code.


Actually it is not about the tray icon.I just want to know how to minimize the main window when I close the taskbar icon.And why electron doesn’t have an api for taskbar?


It would help if you specified which OS you’re referring to. Different operating systems have different ways they operate and it may be that you’re misunderstanding the operating system’s standard way of doing things.

Additionally, please include a space after each period, comma, exclamation point or question mark. It will make your text easier for others to read.


Window 10. Just like this:


If I’m understanding your description correctly, you should probably take a look at the boilerplate in the Quick Start section of the documentation on the Electron website:

It has a number of comments about how to handle window management that follow standard operating system conventions.