I have asked this question on a number of different forums and have not been able to find a solution. Can ANYONE tell me if this can be done?
When launched my Browserwindow currently sits on top of every other application that's running and is placed at the top of my screen which is what i want. However i also want the browser window to SIT ABOVE other applications. google chrome and other browsers such as Microsoft edge should sit below the electron app.
I've looked at discussions online and apparently this is doable on macOs, however no ones really said for definite if this can be done on windows devices or not.
Heres my code:
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1920,
height: 200,
alwaysOnTop:true,
titleBarStyle: 'none',
frame: false,
resizable: false,
minimizable: false,
type: 'toolbar',
webPreferences: {
nodeIntegration: true,
contextIsolation: false}
});
mainWindow.setAlwaysOnTop(true, "screen-saver");
mainWindow.setVisibleOnAllWorkspaces(true);
mainWindow.setMenuBarVisibility(false);
mainWindow.moveTop();
mainWindow.setPosition(0,0)
// and load the index.html of the app.
mainWindow.loadFile(path.join(__dirname, 'index.html'));
Does anyone have a solution for this?
Thankyou
I do not believe that this is natively possible on Windows and Linux OS machines using Electron and Node.js alone.
I believe you will need to write a C++ script that can query the OS windows that are open. Then by communicating back and forth between the C++ script and Electron, your Electron application can then become 'aware' of the position of the other windows. Then, though your C++ script, set the position and size of the other window(s) to snap to the bottom of your Electron application window.