TagSpaces is an offline, open source, document manager with tagging support
hide new instance
kristiyanddb4d34c84eb26
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.jsindex 32fb3f4c1..cdc5389dd 100644--- a/data/electron/electron.api.js+++ b/data/electron/electron.api.js@@ -72,7 +72,10 @@ define(function(require, exports, module) {{label: $.i18n.t("ns.common:openNewInstance"),accelerator: '',- click: TSCORE.UI.openNewInstance+ //click: TSCORE.UI.openNewInstance+ click: function() {+ ipcRenderer.send("new-win", "newWin");+ }},{type: 'separator'diff --git a/data/electron/main.js b/data/electron/main.jsindex f4d0936e7..48074a511 100644--- a/data/electron/main.js+++ b/data/electron/main.js@@ -36,6 +36,7 @@ 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.var mainWindow = null;+//var childWindow = null;// Quit when all windows are closed.app.on('window-all-closed', function() {@@ -51,6 +52,36 @@ app.on('will-quit', function() {globalShortcut.unregisterAll();});++ipcMain.on("new-win", function() {+ var newWindow = new BrowserWindow({width: 1280, height: 768});+ //var indexPath = 'file://' + __dirname + '/index.html';+ var startupParameter = "";+ if (startupFilePath) {+ startupParameter = "?open=" + encodeURIComponent(startupFilePath);+ }+ var indexPath = 'file://' + path.dirname(__dirname) + '/index.html' + startupParameter;++ newWindow.setMenu(null);+ newWindow.loadURL(indexPath);++ if (debugMode) {+ newWindow.webContents.openDevTools();+ }++ newWindow.once('ready-to-show', function() {+ newWindow.show()+ });++ ipcMain.on('win-close', function(e, arg) {+ newWindow.hide();+ });++ ipcMain.on('close', function(e, arg) {+ newWindow.hide();+ });+});+app.on('ready', function(event) {//console.log(app.getLocale());//console.log(app.getAppPath());@@ -78,6 +109,10 @@ app.on('ready', function(event) {mainWindow = null;});+ ipcMain.on('close', function(e, arg) {+ mainWindow.hide();+ });+mainWindow.webContents.on('crashed', function() {const options = {type: 'info',@@ -95,11 +130,16 @@ app.on('ready', function(event) {});});+ //ipcMain.on('win-close', function(e, arg) {+ // mainWindow.hide();+ //});+var trayIconPath;if (process.platform === 'darwin') {trayIconPath = 'Contents/Resources/app/assets/trayicon.png';} else if (process.platform === 'win32') {trayIconPath = 'resources/app/assets/trayicon.png';+ trayIconPath = 'assets/trayicon.png';} else {trayIconPath = 'resources/app/assets/trayicon.png';}@@ -110,7 +150,6 @@ app.on('ready', function(event) {trayIcon = new Tray(trayIconPath);-var trayMenuTemplate = [{label: 'Show TagSpaces',