2024-10-18 19:57:13 +02:00
|
|
|
import { app, BrowserWindow } from 'electron';
|
|
|
|
|
|
|
|
// A helper function for creating the window
|
|
|
|
const createWindow = () => {
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
width: 290,
|
2024-10-18 20:02:33 +02:00
|
|
|
height: 470,
|
2024-10-18 19:57:13 +02:00
|
|
|
resizable: false,
|
|
|
|
autoHideMenuBar: true,
|
|
|
|
useContentSize: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
win.loadFile('static/index.html');
|
|
|
|
};
|
2024-10-16 22:46:58 +02:00
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
|
|
|
createWindow();
|
|
|
|
|
2024-10-17 22:48:50 +02:00
|
|
|
// This event works on macOS only.
|
|
|
|
// If the user clicks on app's icon on the dock and there are no open windows, create one.
|
2024-10-16 22:46:58 +02:00
|
|
|
app.on('activate', () => {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-10-17 22:48:50 +02:00
|
|
|
// If all windows are closed and we're not running macOS, quit the app.
|
2024-10-16 22:46:58 +02:00
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
if (process.platform !== 'darwin') app.quit();
|
2024-10-18 19:57:13 +02:00
|
|
|
});
|