keyboard handlers for tabs

This commit is contained in:
zadam
2020-01-20 20:51:22 +01:00
parent 9bc1f5af45
commit c5eac8f438
8 changed files with 57 additions and 49 deletions

View File

@@ -10,9 +10,9 @@ const keyboardActionsLoaded = server.get('keyboard-actions').then(actions => {
for (const shortcut of action.effectiveShortcuts || []) {
if (shortcut && !shortcut.startsWith("global:")) { // global shortcuts should be handled in the electron code
const eventName = action.actionName.charAt(0).toUpperCase() + action.actionName.slice(1);
const eventName = action.actionName.charAt(0).toLowerCase() + action.actionName.slice(1);
utils.bindGlobalShortcut(shortcut, appContext.trigger(eventName));
utils.bindGlobalShortcut(shortcut, () => appContext.trigger(eventName));
}
}
}
@@ -103,34 +103,6 @@ function updateDisplayedShortcuts($container) {
$(() => updateDisplayedShortcuts($(document)));
setGlobalActionHandler('OpenNewTab', () => {
appContext.openEmptyTab();
});
setGlobalActionHandler('CloseActiveTab', () => {
if (this.tabRow.activeTabEl) {
this.tabRow.removeTab(this.tabRow.activeTabId);
}
});
setGlobalActionHandler('ActivateNextTab', () => {
const nextTab = this.tabRow.nextTabEl;
if (nextTab) {
// FIXME
this.tabRow.activateTab(nextTab);
}
});
setGlobalActionHandler('ActivatePreviousTab', () => {
const prevTab = this.tabRow.previousTabEl;
if (prevTab) {
// FIXME
this.tabRow.activateTab(prevTab);
}
});
export default {
setGlobalActionHandler,
setElementActionHandler,