mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-18 05:20:45 +00:00
gh-13133: Add Duplicate tab keyboard shortcut (gh-13123)
Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
@@ -357,3 +357,4 @@ 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-new-unsynced-window-shortcut = New Blank Window
|
||||
zen-duplicate-tab-shortcut = Duplicate Tab
|
||||
@@ -66,4 +66,6 @@
|
||||
<command id="cmd_zenNewNavigatorUnsynced" />
|
||||
|
||||
<command id="cmd_zenNewLiveFolder" />
|
||||
|
||||
<command id="cmd_zenDuplicateTab" />
|
||||
</commandset>
|
||||
|
||||
@@ -143,6 +143,14 @@ document.addEventListener(
|
||||
ZenLiveFoldersManager.handleEvent(event);
|
||||
break;
|
||||
}
|
||||
case "cmd_zenDuplicateTab": {
|
||||
const selectedTabs = gBrowser.selectedTabs;
|
||||
let insertAt = selectedTabs.at(-1)._tPos + 1;
|
||||
for (const tab of selectedTabs) {
|
||||
gBrowser.duplicateTab(tab, true, { tabIndex: insertAt++ });
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
gZenGlanceManager.handleMainCommandSet(event);
|
||||
if (event.target.id.startsWith("cmd_zenWorkspaceSwitch")) {
|
||||
|
||||
@@ -832,7 +832,7 @@ class nsZenKeyboardShortcutsLoader {
|
||||
}
|
||||
|
||||
class nsZenKeyboardShortcutsVersioner {
|
||||
static LATEST_KBS_VERSION = 16;
|
||||
static LATEST_KBS_VERSION = 17;
|
||||
|
||||
constructor() {}
|
||||
|
||||
@@ -1196,6 +1196,22 @@ class nsZenKeyboardShortcutsVersioner {
|
||||
}
|
||||
}
|
||||
|
||||
if (version < 17) {
|
||||
// Migrate from version 16 to 17.
|
||||
// Add shortcut to Duplicate Tab
|
||||
data.push(
|
||||
new KeyShortcut(
|
||||
"zen-duplicate-tab",
|
||||
"",
|
||||
"",
|
||||
"windowAndTabManagement",
|
||||
nsKeyShortcutModifiers.fromObject({}),
|
||||
"cmd_zenDuplicateTab",
|
||||
"zen-duplicate-tab-shortcut"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user