Start settings display; fix settings not reopening
This commit is contained in:
parent
bea31a8131
commit
4bcdf69531
2 changed files with 36 additions and 19 deletions
|
@ -5,7 +5,14 @@
|
|||
<title>Settings</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World this is settings!</h1>
|
||||
<div class="container-fluid">
|
||||
<div class="row separator align-items-center">
|
||||
<div class="col"><hr class="separator"></div>
|
||||
<div class="col-auto">Settings</div>
|
||||
<div class="col"><hr class="separator"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="/src/settings.js"></script>
|
||||
</body>
|
||||
</html>
|
42
src/main.js
42
src/main.js
|
@ -6,11 +6,12 @@ if (require('electron-squirrel-startup')) {
|
|||
app.quit();
|
||||
}
|
||||
|
||||
let mainWindow;
|
||||
let settingsWindow;
|
||||
|
||||
const createWindow = () => {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 800,
|
||||
webPreferences: {
|
||||
|
@ -32,20 +33,6 @@ const createWindow = () => {
|
|||
if (!app.isPackaged) {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
// Create the settings window that we can use later.
|
||||
settingsWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
parent: mainWindow,
|
||||
modal: true,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
additionalArguments: [`EDS-ENV=${app.isPackaged}`],
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
|
@ -74,13 +61,36 @@ app.on('activate', () => {
|
|||
// code. You can also put them in separate files and import them here.
|
||||
|
||||
const openSettings = async () => {
|
||||
settingsWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
parent: mainWindow,
|
||||
modal: true,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
additionalArguments: [`EDS-ENV=${app.isPackaged}`],
|
||||
},
|
||||
});
|
||||
|
||||
if (SETTINGS_WINDOW_VITE_DEV_SERVER_URL) {
|
||||
settingsWindow.loadURL(`${SETTINGS_WINDOW_VITE_DEV_SERVER_URL}/settings.html`);
|
||||
} else {
|
||||
settingsWindow.loadFile(path.join(__dirname, `../renderer/${SETTINGS_WINDOW_VITE_NAME}/settings.html`));
|
||||
}
|
||||
|
||||
settingsWindow.show()
|
||||
// Open the DevTools.
|
||||
if (!app.isPackaged) {
|
||||
settingsWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
settingsWindow.show();
|
||||
|
||||
// Make sure window is destroyed on close, or else it won't open again.
|
||||
settingsWindow.on('closed', () => {
|
||||
settingsWindow = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
const menuTemplate = [
|
||||
|
|
Loading…
Reference in a new issue