Skip to content
Advertisement

I want a method in electron module to hide it in taskbar

I want someone to help me out in this problem. I want to know a method which hides my application from the taskbar. I want to make an app that works in the background.

I am new to the electron, therefore I hadn’t known anything about it. So, I hadn’t actually tried anything out.

Advertisement

Answer

you can prevent it before close and hide window.

const {app} = require('electron');
const winConfig = {
        minWidth: 420,
        minHeight: 530,
        width: 400,
        height: 530
    }
app.on('ready', () => {
   win = new BrowserWindow(winConfig);
   win.on('close', function (event){
      event.preventDefault()
      win.hide()
      return false
   })
})

with this code it prevent to close window and for quit app you can call app.quit(). if you use this and send your app to background I recommend you to use tray module for restore and have access your app again.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement