Skip to content

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

global key binding

kristiyandd95d9892fea3a
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.js
index ce31cb0e8..66a2ce818 100644
--- a/data/electron/electron.api.js
+++ b/data/electron/electron.api.js
@@ -8,7 +8,6 @@ const electron = require('electron'); // jshint ignore:line
const remote = electron.remote; // jshint ignore:line
const ipcRenderer = require('electron').ipcRenderer; // jshint ignore:line
-
/**
* A implementation of the IOAPI for the electron platform
* @class Electron
@@ -388,20 +387,40 @@ define(function(require, exports, module) {
var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
- ipcRenderer.on("newfile", function (event, arg) {
+ ipcRenderer.on("new-file", function(event, arg) {
+ if (!TSCORE.currentPath) {
+ TSCORE.showAlertDialog($.i18n.t("ns.common:alertOpenLocatioFirst"));
+ } else {
+ TSCORE.UI.createTXTFile();
+ }
+ });
+
+ ipcRenderer.on("next-file", function(event, arg) {
+ if(TSCORE.selectedFiles[0]) {
+ TSCORE.FileOpener.openFile(TSCORE.PerspectiveManager.getNextFile(TSCORE.FileOpener.getOpenedFilePath()));
+ } else {
+ TSCORE.showAlertDialog($.i18n.t("ns.common:selectFile"));
+ }
+ });
+
+ ipcRenderer.on("previous-file", function(event, arg) {
+ if(TSCORE.selectedFiles[0]) {
+ TSCORE.FileOpener.openFile(TSCORE.PerspectiveManager.getPrevFile(TSCORE.FileOpener.getOpenedFilePath()));
+ } else {
+ TSCORE.showAlertDialog($.i18n.t("ns.common:selectFile"));
+ }
+ });
+
+ ipcRenderer.on("play", function(event, arg) {
console.debug(arg);
- //if(arg === 'newFile') {
- if (!TSCORE.currentPath) {
- TSCORE.showAlertDialog("ns.common:alertOpenLocatioFirst");
- } else {
- TSCORE.UI.createTXTFile();
- }
- //}
});
- ipcRenderer.on("ping", function (event, arg) {
+ ipcRenderer.on("play-pause", function(event, arg) {
console.debug(arg);
+ });
+ ipcRenderer.on("showing-tagspaces", function(event, arg) {
+ TSCORE.UI.openNewInstance();
});
}
diff --git a/data/electron/main.js b/data/electron/main.js
index 45df717bd..ff2b717c6 100644
--- a/data/electron/main.js
+++ b/data/electron/main.js
@@ -131,25 +131,27 @@ app.on('ready', function(event) {
trayIcon.setTitle(title);
trayIcon.setContextMenu(trayMenu);
-
globalShortcut.register('ctrl+Alt+space', function(){
mainWindow.webContents.send('play-pause', 'play-pause');
});
globalShortcut.register('ctrl+Alt+P', function(){
- mainWindow.webContents.send('ping', 'play');
+ mainWindow.webContents.send('play', 'play');
});
globalShortcut.register('ctrl+Alt+N', function(){
- mainWindow.webContents.send("newfile" ,"newFile");
+ mainWindow.webContents.send("new-file" ,"new");
+ });
+
+ globalShortcut.register('ctrl+Alt+I', function(){
+ mainWindow.webContents.send("next-file" ,"next");
+ });
+
+ globalShortcut.register('ctrl+Alt+O', function(){
+ mainWindow.webContents.send("previous-file" ,"previous");
});
- globalShortcut.register('CommandOrControl+Alt+K', function () {
- dialog.showMessageBox({
- type: 'info',
- message: 'Success!',
- detail: 'You pressed the registered global shortcut keybinding.',
- buttons: ['OK']
- })
+ globalShortcut.register('CommandOrControl+Alt+T', function () {
+ mainWindow.webContents.send("showing-tagspaces" ,"tagspaces");
})
});
diff --git a/data/locales/en_US/ns.common.json b/data/locales/en_US/ns.common.json
index 24b566adb..1091ecb18 100644
--- a/data/locales/en_US/ns.common.json
+++ b/data/locales/en_US/ns.common.json
@@ -252,6 +252,6 @@
"exitApp":"Exit",
"openNewInstance":"New Application Window",
"documentation":"Documentation",
+ "selectFile": "Please select a file first.",
"-": "-"
-
}