diff --git a/index.html b/index.html
index 5209eb1..0c009cb 100755
--- a/index.html
+++ b/index.html
@@ -8,7 +8,7 @@
diff --git a/src/main.js b/src/main.js
index b4d19f7..41d0070 100755
--- a/src/main.js
+++ b/src/main.js
@@ -1,4 +1,4 @@
-const { app, BrowserWindow, Menu } = require('electron');
+const { app, BrowserWindow, Menu, ipcMain } = require('electron');
const path = require('path');
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
@@ -37,10 +37,20 @@ const createWindow = () => {
}
};
+// Set up close window handler for our custom close button.
+const closeWindow = (event) => {
+ const webContents = event.sender;
+ const window = BrowserWindow.fromWebContents(webContents);
+ window?.close();
+}
+
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
-app.on('ready', createWindow);
+app.on('ready', () => {
+ ipcMain.on('CLOSE_WINDOW', closeWindow);
+ createWindow();
+});
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
diff --git a/src/renderer.js b/src/renderer.js
index 6a1cb81..d23e52c 100755
--- a/src/renderer.js
+++ b/src/renderer.js
@@ -32,7 +32,7 @@ import './icons/flaticon.css'
import './assets/ldom.min'
-const { app } = require('electron')
+const { app, ipcRenderer } = require('electron')
import { Safari } from './models/Safari'
import { UI } from './models/UI'
import { Body } from './models/Body'
@@ -60,6 +60,12 @@ if (!journal) {
safari.watchJournalDir()
journal.watch()
+/* -------------------------------------------------------------------- close window handler ---- */
+
+$('#closeBtn').on('click', () => {
+ ipcRenderer.send('CLOSE_WINDOW')
+})
+
/* ------------------------------------------------------------------------- build body list ---- */
journal.once('BUILD_BODY_LIST', () => {