From 332c595019f73bd5fe1ae638461f4ca30a363842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Santos?= Date: Tue, 11 Nov 2025 14:42:18 +0000 Subject: [PATCH 1/2] Feature: previous/next tab shortcuts --- .../browser/preferences/zen-preferences.ftl | 2 ++ .../base/content/zen-commands.inc.xhtml | 5 ++- src/zen/common/zen-sets.js | 6 ++++ src/zen/kbs/ZenKeyboardShortcuts.mjs | 35 ++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/locales/en-US/browser/browser/preferences/zen-preferences.ftl b/locales/en-US/browser/browser/preferences/zen-preferences.ftl index 2941a51573..12ba94e2b6 100644 --- a/locales/en-US/browser/browser/preferences/zen-preferences.ftl +++ b/locales/en-US/browser/browser/preferences/zen-preferences.ftl @@ -350,3 +350,5 @@ zen-devtools-toggle-storage-shortcut = Toggle Storage zen-devtools-toggle-dom-shortcut = Toggle DOM zen-devtools-toggle-accessibility-shortcut = Toggle Accessibility zen-close-all-unpinned-tabs-shortcut = Close All Unpinned Tabs +zen-tab-next-shortcut = Next Tab +zen-tab-previous-shortcut = Previous Tab diff --git a/src/browser/base/content/zen-commands.inc.xhtml b/src/browser/base/content/zen-commands.inc.xhtml index 66cfe1c5bc..74e8365793 100644 --- a/src/browser/base/content/zen-commands.inc.xhtml +++ b/src/browser/base/content/zen-commands.inc.xhtml @@ -61,4 +61,7 @@ - + + + + \ No newline at end of file diff --git a/src/zen/common/zen-sets.js b/src/zen/common/zen-sets.js index b7b6c00ad6..e1af97e96d 100644 --- a/src/zen/common/zen-sets.js +++ b/src/zen/common/zen-sets.js @@ -129,6 +129,12 @@ document.addEventListener( gZenWorkspaces.unloadWorkspace(); break; } + case 'cmd_zenTabNext': + gBrowser.tabContainer.advanceSelectedTab(1, true); + break; + case 'cmd_zenTabPrevious': + gBrowser.tabContainer.advanceSelectedTab(-1, true); + break; default: gZenGlanceManager.handleMainCommandSet(event); if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) { diff --git a/src/zen/kbs/ZenKeyboardShortcuts.mjs b/src/zen/kbs/ZenKeyboardShortcuts.mjs index 777d1fbfe5..20c46c7ee9 100644 --- a/src/zen/kbs/ZenKeyboardShortcuts.mjs +++ b/src/zen/kbs/ZenKeyboardShortcuts.mjs @@ -52,6 +52,8 @@ const defaultKeyboardGroups = { 'zen-close-all-unpinned-tabs-shortcut', 'zen-close-tab-shortcut', 'zen-close-shortcut', + 'zen-tab-next-shortcut', + 'zen-tab-previous-shortcut', 'id:key_selectTab1', 'id:key_selectTab2', 'id:key_selectTab3', @@ -800,7 +802,7 @@ class nsZenKeyboardShortcutsLoader { } class nsZenKeyboardShortcutsVersioner { - static LATEST_KBS_VERSION = 13; + static LATEST_KBS_VERSION = 14; constructor() {} @@ -1096,6 +1098,37 @@ class nsZenKeyboardShortcutsVersioner { ); } + if (version < 14) { + // Migrate from version 13 to 14 + // Add customizable tab navigation shortcuts (Next Tab and Previous Tab) + if (!data.find(s => s.id === 'zen-tab-next')) { + data.push( + new KeyShortcut( + 'zen-tab-next', + '', + 'VK_TAB', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({ accel: true }), + 'cmd_zenTabNext', + 'zen-tab-next-shortcut' + ) + ); + } + if (!data.find(s => s.id === 'zen-tab-previous')) { + data.push( + new KeyShortcut( + 'zen-tab-previous', + '', + 'VK_TAB', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }), + 'cmd_zenTabPrevious', + 'zen-tab-previous-shortcut' + ) + ); + } + } + return data; } } From 8408685a904d6b193ffce7cc623a943dad9b9291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Santos?= Date: Tue, 11 Nov 2025 17:48:06 +0000 Subject: [PATCH 2/2] feature: move tab shortcuts --- .../browser/preferences/zen-preferences.ftl | 2 + .../base/content/zen-commands.inc.xhtml | 2 + src/zen/common/zen-sets.js | 6 ++ src/zen/kbs/ZenKeyboardShortcuts.mjs | 74 ++++++++++++------- 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/locales/en-US/browser/browser/preferences/zen-preferences.ftl b/locales/en-US/browser/browser/preferences/zen-preferences.ftl index 12ba94e2b6..02d692fbce 100644 --- a/locales/en-US/browser/browser/preferences/zen-preferences.ftl +++ b/locales/en-US/browser/browser/preferences/zen-preferences.ftl @@ -352,3 +352,5 @@ zen-devtools-toggle-accessibility-shortcut = Toggle Accessibility zen-close-all-unpinned-tabs-shortcut = Close All Unpinned Tabs zen-tab-next-shortcut = Next Tab zen-tab-previous-shortcut = Previous Tab +zen-move-tab-forward-shortcut = Move Tab Forward +zen-move-tab-backward-shortcut = Move Tab Backward diff --git a/src/browser/base/content/zen-commands.inc.xhtml b/src/browser/base/content/zen-commands.inc.xhtml index 74e8365793..3a1211e53d 100644 --- a/src/browser/base/content/zen-commands.inc.xhtml +++ b/src/browser/base/content/zen-commands.inc.xhtml @@ -64,4 +64,6 @@ + + \ No newline at end of file diff --git a/src/zen/common/zen-sets.js b/src/zen/common/zen-sets.js index e1af97e96d..23600926c8 100644 --- a/src/zen/common/zen-sets.js +++ b/src/zen/common/zen-sets.js @@ -135,6 +135,12 @@ document.addEventListener( case 'cmd_zenTabPrevious': gBrowser.tabContainer.advanceSelectedTab(-1, true); break; + case 'cmd_zenMoveTabForward': + gBrowser.moveTabForward(); + break; + case 'cmd_zenMoveTabBackward': + gBrowser.moveTabBackward(); + break; default: gZenGlanceManager.handleMainCommandSet(event); if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) { diff --git a/src/zen/kbs/ZenKeyboardShortcuts.mjs b/src/zen/kbs/ZenKeyboardShortcuts.mjs index 20c46c7ee9..5526a84668 100644 --- a/src/zen/kbs/ZenKeyboardShortcuts.mjs +++ b/src/zen/kbs/ZenKeyboardShortcuts.mjs @@ -54,6 +54,8 @@ const defaultKeyboardGroups = { 'zen-close-shortcut', 'zen-tab-next-shortcut', 'zen-tab-previous-shortcut', + 'zen-move-tab-forward-shortcut', + 'zen-move-tab-backward-shortcut', 'id:key_selectTab1', 'id:key_selectTab2', 'id:key_selectTab3', @@ -1100,33 +1102,51 @@ class nsZenKeyboardShortcutsVersioner { if (version < 14) { // Migrate from version 13 to 14 - // Add customizable tab navigation shortcuts (Next Tab and Previous Tab) - if (!data.find(s => s.id === 'zen-tab-next')) { - data.push( - new KeyShortcut( - 'zen-tab-next', - '', - 'VK_TAB', - 'windowAndTabManagement', - nsKeyShortcutModifiers.fromObject({ accel: true }), - 'cmd_zenTabNext', - 'zen-tab-next-shortcut' - ) - ); - } - if (!data.find(s => s.id === 'zen-tab-previous')) { - data.push( - new KeyShortcut( - 'zen-tab-previous', - '', - 'VK_TAB', - 'windowAndTabManagement', - nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }), - 'cmd_zenTabPrevious', - 'zen-tab-previous-shortcut' - ) - ); - } + // Add customizable tab navigation and move tab shortcuts + data.push( + new KeyShortcut( + 'zen-tab-next', + '', + 'VK_TAB', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({ accel: true }), + 'cmd_zenTabNext', + 'zen-tab-next-shortcut' + ) + ); + data.push( + new KeyShortcut( + 'zen-tab-previous', + '', + 'VK_TAB', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }), + 'cmd_zenTabPrevious', + 'zen-tab-previous-shortcut' + ) + ); + data.push( + new KeyShortcut( + 'zen-move-tab-forward', + '', + '', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({}), + 'cmd_zenMoveTabForward', + 'zen-move-tab-forward-shortcut' + ) + ); + data.push( + new KeyShortcut( + 'zen-move-tab-backward', + '', + '', + 'windowAndTabManagement', + nsKeyShortcutModifiers.fromObject({}), + 'cmd_zenMoveTabBackward', + 'zen-move-tab-backward-shortcut' + ) + ); } return data;