QarthO
QarthO

Reputation: 81

Set browserWindow Always on top, Even if Other Apps/Games are in fullscreen [Electron, Windows OS]

How do I let me electron app be ontop of other apps or games that are in fullscreen mode, like an overlay on Windows.

This mainWindow.setAlwaysOnTop(true, "level"); works for most apps.

https://www.electronjs.org/docs/latest/api/browser-window

I've checked the electron docs and tried every different 'level' none of them work in games that are fullscreen.

Code:

  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
  });

  // and load the index.html of the app.
  mainWindow.loadFile(path.join(__dirname, 'index.html'));

  mainWindow.setAlwaysOnTop(true, "level");


  // Open the DevTools.
  // mainWindow.webContents.openDevTools();
};

I'm currently testing this in League of Legends. Changing video setting to borderless, the window shows, however changing to fullscreen, the electron window is no longer infront.

I know its possible, because Discord (made with electron) has an overlay that is shown in games that are set to fullscreen.

Upvotes: 2

Views: 1621

Answers (1)

skara9
skara9

Reputation: 4194

Overlays aren't possible in electron.js, since it only interacts with the standard win32 api.

If I recall correctly, discord uses a separate, lower level application for their overlays.

Upvotes: 0

Related Questions