Skip to content

Commit 8408685

Browse files
feature: move tab shortcuts
1 parent 332c595 commit 8408685

File tree

4 files changed

+57
-27
lines changed

4 files changed

+57
-27
lines changed

locales/en-US/browser/browser/preferences/zen-preferences.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,5 @@ zen-devtools-toggle-accessibility-shortcut = Toggle Accessibility
352352
zen-close-all-unpinned-tabs-shortcut = Close All Unpinned Tabs
353353
zen-tab-next-shortcut = Next Tab
354354
zen-tab-previous-shortcut = Previous Tab
355+
zen-move-tab-forward-shortcut = Move Tab Forward
356+
zen-move-tab-backward-shortcut = Move Tab Backward

src/browser/base/content/zen-commands.inc.xhtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@
6464

6565
<command id="cmd_zenTabNext" />
6666
<command id="cmd_zenTabPrevious" />
67+
<command id="cmd_zenMoveTabForward" />
68+
<command id="cmd_zenMoveTabBackward" />
6769
</commandset>

src/zen/common/zen-sets.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ document.addEventListener(
135135
case 'cmd_zenTabPrevious':
136136
gBrowser.tabContainer.advanceSelectedTab(-1, true);
137137
break;
138+
case 'cmd_zenMoveTabForward':
139+
gBrowser.moveTabForward();
140+
break;
141+
case 'cmd_zenMoveTabBackward':
142+
gBrowser.moveTabBackward();
143+
break;
138144
default:
139145
gZenGlanceManager.handleMainCommandSet(event);
140146
if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) {

src/zen/kbs/ZenKeyboardShortcuts.mjs

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const defaultKeyboardGroups = {
5454
'zen-close-shortcut',
5555
'zen-tab-next-shortcut',
5656
'zen-tab-previous-shortcut',
57+
'zen-move-tab-forward-shortcut',
58+
'zen-move-tab-backward-shortcut',
5759
'id:key_selectTab1',
5860
'id:key_selectTab2',
5961
'id:key_selectTab3',
@@ -1100,33 +1102,51 @@ class nsZenKeyboardShortcutsVersioner {
11001102

11011103
if (version < 14) {
11021104
// Migrate from version 13 to 14
1103-
// Add customizable tab navigation shortcuts (Next Tab and Previous Tab)
1104-
if (!data.find(s => s.id === 'zen-tab-next')) {
1105-
data.push(
1106-
new KeyShortcut(
1107-
'zen-tab-next',
1108-
'',
1109-
'VK_TAB',
1110-
'windowAndTabManagement',
1111-
nsKeyShortcutModifiers.fromObject({ accel: true }),
1112-
'cmd_zenTabNext',
1113-
'zen-tab-next-shortcut'
1114-
)
1115-
);
1116-
}
1117-
if (!data.find(s => s.id === 'zen-tab-previous')) {
1118-
data.push(
1119-
new KeyShortcut(
1120-
'zen-tab-previous',
1121-
'',
1122-
'VK_TAB',
1123-
'windowAndTabManagement',
1124-
nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }),
1125-
'cmd_zenTabPrevious',
1126-
'zen-tab-previous-shortcut'
1127-
)
1128-
);
1129-
}
1105+
// Add customizable tab navigation and move tab shortcuts
1106+
data.push(
1107+
new KeyShortcut(
1108+
'zen-tab-next',
1109+
'',
1110+
'VK_TAB',
1111+
'windowAndTabManagement',
1112+
nsKeyShortcutModifiers.fromObject({ accel: true }),
1113+
'cmd_zenTabNext',
1114+
'zen-tab-next-shortcut'
1115+
)
1116+
);
1117+
data.push(
1118+
new KeyShortcut(
1119+
'zen-tab-previous',
1120+
'',
1121+
'VK_TAB',
1122+
'windowAndTabManagement',
1123+
nsKeyShortcutModifiers.fromObject({ accel: true, shift: true }),
1124+
'cmd_zenTabPrevious',
1125+
'zen-tab-previous-shortcut'
1126+
)
1127+
);
1128+
data.push(
1129+
new KeyShortcut(
1130+
'zen-move-tab-forward',
1131+
'',
1132+
'',
1133+
'windowAndTabManagement',
1134+
nsKeyShortcutModifiers.fromObject({}),
1135+
'cmd_zenMoveTabForward',
1136+
'zen-move-tab-forward-shortcut'
1137+
)
1138+
);
1139+
data.push(
1140+
new KeyShortcut(
1141+
'zen-move-tab-backward',
1142+
'',
1143+
'',
1144+
'windowAndTabManagement',
1145+
nsKeyShortcutModifiers.fromObject({}),
1146+
'cmd_zenMoveTabBackward',
1147+
'zen-move-tab-backward-shortcut'
1148+
)
1149+
);
11301150
}
11311151

11321152
return data;

0 commit comments

Comments
 (0)