Set browserWindow Always on top, even other app is in fullscreen


#1

it’s possible to use custom window level in Electron Framework, for make window always on top, even other apps is in fullscreen ?

For native MacOS apps i found this: http://stackoverflow.com/a/27397096/5838242
Where he saying:
window.level = Int(CGWindowLevelForKey(kCGMaximumWindowLevelKey))

On electron, i have a browser window:
mainWindow = new BrowserWindow({width: 1400, height: 50, resizable: false, alwaysOnTop: true, y: 0, x: 0, minimizable: false, title: 'CD App', frame: false, titleBarStyle: 'hidden', type: 'desktop' });

I know the ‘type’ parameter is the POINT, but this parameter have just two options:

On macOS, possible types are desktop, textured. The textured type adds metal gradient appearance (NSTexturedBackgroundWindowMask). The desktop type places the window at the desktop background window level (kCGDesktopWindowLevel - 1). Note that desktop window will not receive focus, keyboard or mouse events, but you can use globalShortcut to receive input sparingly.

So, any possibilities to do this thing ?


#2

Hi Paulo,

I’m trying to do the same thing. Did you find a solution?

Thanks


#3

Anyone found a solution for this yet, I am trying to solve that sample problem…


#4

The best solution I’ve found is

// hides the dock icon for our app which allows our windows to join other 
// apps' spaces. without this our windows open on the nearest "desktop" space
app.dock.hide();
// "floating" + 1 is higher than all regular windows, but still behind things 
// like spotlight or the screen saver
win.setAlwaysOnTop(true, "floating", 1);
// allows the window to show over a fullscreen window
win.setVisibleOnAllWorkspaces(true);

This works fine if you are ok with not having a dock icon for any window and not letting user cmd+tab to your windows. If you find a better solution I’d love to hear about it.