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>
|
<title>Settings</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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>
|
<script type="module" src="/src/settings.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
46
src/main.js
46
src/main.js
|
@ -6,11 +6,12 @@ if (require('electron-squirrel-startup')) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mainWindow;
|
||||||
let settingsWindow;
|
let settingsWindow;
|
||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 1000,
|
width: 1000,
|
||||||
height: 800,
|
height: 800,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
@ -20,32 +21,18 @@ const createWindow = () => {
|
||||||
additionalArguments: [`EDS-ENV=${app.isPackaged}`],
|
additionalArguments: [`EDS-ENV=${app.isPackaged}`],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
|
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
|
||||||
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
|
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
|
||||||
} else {
|
} else {
|
||||||
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
|
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
mainWindow.webContents.openDevTools();
|
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
|
// 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.
|
// code. You can also put them in separate files and import them here.
|
||||||
|
|
||||||
const openSettings = async () => {
|
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) {
|
if (SETTINGS_WINDOW_VITE_DEV_SERVER_URL) {
|
||||||
settingsWindow.loadURL(`${SETTINGS_WINDOW_VITE_DEV_SERVER_URL}/settings.html`);
|
settingsWindow.loadURL(`${SETTINGS_WINDOW_VITE_DEV_SERVER_URL}/settings.html`);
|
||||||
} else {
|
} else {
|
||||||
settingsWindow.loadFile(path.join(__dirname, `../renderer/${SETTINGS_WINDOW_VITE_NAME}/settings.html`));
|
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 = [
|
const menuTemplate = [
|
||||||
|
|
Loading…
Reference in a new issue