Skip to content

TagSpaces is an offline, open source, document manager with tagging support

implementing application quiting on osx

uggrockfc5f081d2414
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.js
index 40e73b0e2..dbad704ea 100644
--- a/data/electron/electron.api.js
+++ b/data/electron/electron.api.js
@@ -6,6 +6,8 @@ const fs = require('fs-extra'); // jshint ignore:line
const pathUtils = require('path'); // jshint ignore:line
const electron = require('electron'); // jshint ignore:line
const remote = electron.remote; // jshint ignore:line
+const ipcRenderer = require('electron').ipcRenderer;
+
/**
* A implementation of the IOAPI for the electron platform
* @class Electron
@@ -195,7 +197,9 @@ define(function(require, exports, module) {
{
label: $.i18n.t("ns.common:quit"),
accelerator: 'Command+Q',
- click: function() { app.quit(); }
+ click: function() {
+ ipcRenderer.send('quit-application', 'Bye, bye...');
+ }
},
]
});
diff --git a/data/electron/main.js b/data/electron/main.js
index 40fae0c8c..78e457177 100644
--- a/data/electron/main.js
+++ b/data/electron/main.js
@@ -3,6 +3,7 @@
const electron = require('electron');
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
+const ipcMain = require('electron').ipcMain;
var debugMode;
var startupFilePath;
@@ -22,6 +23,11 @@ process.argv.forEach(function(arg, count) {
}
});
+ipcMain.on('quit-application', function(event, arg) {
+ //console.log(arg);
+ app.quit();
+});
+
var path = require('path');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.