Глеб
Глеб

Reputation: 21

How to make Electron in a window on top of all other Windows as an indicator of Skype

Help to make the same window, as with Skype when we call, we see window with call info, via Electron. The point is that this window is always on top of all Windows on your computer, including games.

The alwaysOnTop parameter: true sets the window in front of all other Windows, but the game covers it in full-screen mode.

Is it possible and how it can be implemented in the Electron or in what ways it can be done?

Upvotes: 2

Views: 10502

Answers (2)

ParfectShot
ParfectShot

Reputation: 133

Setting window.setAlwaysOnTop(true, "normal") does the trick as suggested by Alok Kamboj

I was stuck on same thing and managed to make always on top work using this particular hack(in this particular order) -

// Tricky way to bring cam bubble to top over fullscreen windows on mac
  win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
  win.setAlwaysOnTop(true, "floating");
  win.setFullScreenable(false);
  // Below statement completes the flow
  win.moveTop();

Now this used to work when I was on electron 9.3.5 and stopped working after I upgraded to 13.1.2. Now I'm able to achieve the same thing using "normal".

Upvotes: 3

user8022331
user8022331

Reputation:

On macOS, it is possible to set the window to be always on top with more options by using the BrowserWindow instance method win.setAlwaysOnTop() instead of the alwaysOnTop flag:

win.setAlwaysOnTop(flag[, level][, relativeLevel])

Values include normal, floating, torn-off-menu, modal-panel, main-menu, status, pop-up-menu, screen-saver, and dock (Deprecated). The default is floating.

You may want to try all possible level values to get the one which may fit your needs.

Upvotes: 4

Related Questions