![]() ![]() Next, we check for window minimization like this: win.on('minimize', () => Sometimes after the icon is in the tray it disappears after a few minutes, this happens because the variable which is used for storing the tray gets garbage collected as mentioned here.This declaration prevents the formation of more than one icon to form in the tray hence preventing clones.This is followed by an important part of code: let tray = null Īlthough it looks insignificant it is important for the following reasons. ![]() The const win fetches the current window, the Tray and Menu constants will be used further to create the tray and menu for the tray respectively. ![]() Since we are using the remote module here we have to automatically enable the same by using enableRemoteModule: true when creating the window. Here we are assuming that the JavaScript file is named render.js.īefore we get started with the main code we will have to declare 4 constants to use like this: const remote = require('electron').remote This article expects that you have some basic knowledge about Electron and also assumes you have a working project.Ĭreate a new JavaScript file (apart from the main existing JavaScript file) and link it to the HTML file like this: With tray icons, the app runs in the background and does not cause visual clutter for the user.Įlectron.js provides a good and effective method for this which can be added to your future app.Īs obviously expected there are some pre-requisites. The aim of this tutorial is on minimizing the app it should be sent to the tray. No separate programming language has to be learned for this too. Although Electron has some problems like consuming more RAM than required or being bloated it is used in many applications ranging from Discord, Whatsapp, Signal, etc.Īpart from this because of it being based on web technologies GUI applications can be built very fast. Learn how to minimize electron application to the system tray.Įlectron.js has gained popularity because it helps to develop cross-platform desktop GUI applications using simple HTML, JavaScript, and CSS. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |