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.

2 Answers

0
mahdi shahbazi On Best Solutions

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.

0
pergy On

You can create your BrowserWindow with skipTaskbar option. See docs for further options.

let win = new BrowserWindow({
  skipTaskbar: true
})