aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-11-06 21:45:02 +0000
committerGitHub <noreply@github.com>2017-11-06 21:45:02 +0000
commit86b534b1e1de03d51efb9f28cd32296d037f07fc (patch)
tree965171f72c09aa3927d020e117b42811e908e160
parent256820f78d0450c55a32557eca13294ab9fdf80f (diff)
parentc4de9ec451f781fa0cc6ce2cd82982d5d66ef787 (diff)
Merge pull request #131 from usk/duplicating-current-tab
add support for duplicating current tab
-rw-r--r--README.md1
-rw-r--r--src/background/actions/operation.js2
-rw-r--r--src/background/tabs.js6
-rw-r--r--src/shared/default-settings.js1
-rw-r--r--src/shared/operations.js1
5 files changed, 10 insertions, 1 deletions
diff --git a/README.md b/README.md
index 2d34a06..e8a9835 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ The default mappings are as follows:
- <kbd>r</kbd>: reload current tab
- <kbd>R</kbd>: reload current tab without cache
- <kbd>zp</kbd>: toggle pin/unpin current tab
+- <kbd>zd</kbd>: duplicate current tab
### Navigation
- <kbd>f</kbd>: start following links in the page
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js
index d0caf80..9876940 100644
--- a/src/background/actions/operation.js
+++ b/src/background/actions/operation.js
@@ -35,6 +35,8 @@ const exec = (operation, tab) => {
return tabs.updateTabPinned(tab, false);
case operations.TAB_TOGGLE_PINNED:
return tabs.toggleTabPinned(tab);
+ case operations.TAB_DUPLICATE:
+ return tabs.duplicate(tab.id);
case operations.ZOOM_IN:
return zooms.zoomIn();
case operations.ZOOM_OUT:
diff --git a/src/background/tabs.js b/src/background/tabs.js
index 23b3b7b..d641616 100644
--- a/src/background/tabs.js
+++ b/src/background/tabs.js
@@ -111,8 +111,12 @@ const toggleTabPinned = (current) => {
updateTabPinned(current, !current.pinned);
};
+const duplicate = (id) => {
+ return browser.tabs.duplicate(id);
+};
+
export {
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, reload,
- updateTabPinned, toggleTabPinned
+ updateTabPinned, toggleTabPinned, duplicate
};
diff --git a/src/shared/default-settings.js b/src/shared/default-settings.js
index e45bee6..14f48be 100644
--- a/src/shared/default-settings.js
+++ b/src/shared/default-settings.js
@@ -33,6 +33,7 @@ export default {
"r": { "type": "tabs.reload", "cache": false },
"R": { "type": "tabs.reload", "cache": true },
"zp": { "type": "tabs.pin.toggle" },
+ "zd": { "type": "tabs.duplicate" },
"zi": { "type": "zoom.in" },
"zo": { "type": "zoom.out" },
"zz": { "type": "zoom.neutral" },
diff --git a/src/shared/operations.js b/src/shared/operations.js
index 1aa4227..f63f7ca 100644
--- a/src/shared/operations.js
+++ b/src/shared/operations.js
@@ -42,6 +42,7 @@ export default {
TAB_PIN: 'tabs.pin',
TAB_UNPIN: 'tabs.unpin',
TAB_TOGGLE_PINNED: 'tabs.pin.toggle',
+ TAB_DUPLICATE: 'tabs.duplicate',
// Zooms
ZOOM_IN: 'zoom.in',