I have been hired for a project. This project is a react app wrapped in an electron. The electron browser windows setting is set to alwaysOnTop.
I need to be able to toggle this on run, from the react code. I tried to get the app or window by importing from the electron lib. as shown here, and descripted here
import { app, BrowserWindow } from 'electron'
The browserwindow doesn’t exist when doing this, and breaks the app. The app is there. but I can't figure out where to go from there, since it contains a lot. but doesn’t look like there is anything relation to the browser window. (Inspect it by logging the app out when running the app)
If anyone out there know anything about how to get this working, I would be a happy panda. Anyway, Thanks for your time
----- UPDATE BY REQUEST ----
I am trying to get access to the window that the application is running in so I can change the alwaysOnTop properties for the main application, by something like an event, fired in the application.
If I Import the BrowserWindow, the system will run. but whenever I try to read anything from this. this system breaks. I know that BrowserWindow is not an object. But I can't seem to see if BrowserWindow should contain a way to get the current open window.
I'm not trying to read the BrowserWindow before it is created. since I am trying to read it for the main window. and not a new BrowserWindow.
The Electron app have json setting. In this there is browserWindow setting, with the alwaysOnTop value. as shown below. If I change it to false, the main App is not running as always on top. But from default I want it to run as always on top. and the from an event like a button click, in the react part of the system. set it to false.
{
"browserWindow": {
"alwaysOnTop": true,
}
}
Hope this helps explain my problem. if not. let me know. thanks for your time