Randomly windows is getting opened. But I have hided the window

Randomly desktop window is getting opened. But I have hided the window.
Here is the code:

private toggleWindows(info)
{

if (!info || !this.isGameFortnite(info))
{
  return;
}
if (info.isRunning) 
{
  this._windows[windowNames.desktop].close();
  this._windows[windowNames.inGame].restore();
  this._windows[windowNames.inGame].hide();
} 
else 
{
   this._windows[windowNames.inGame].close();
   this._windows[windowNames.desktop].restore();
   this._windows[windowNames.desktop].hide();
}

}

It’s a little bit hard to analyze the exact issue with a few lines of code… But I would recommend adding some debug printing to the console inside all the loops to check why the window is “randomly” getting opened. I guess that the isRunning event is triggered when you think it’s not.

Have you checked our sample app code?