diff options
| author | Phil Crosby | 2013-02-17 23:36:10 -0800 |
|---|---|---|
| committer | Phil Crosby | 2013-02-17 23:36:10 -0800 |
| commit | 3e3ccbb5fc89af559dc67fd973abfe2cf1a2e5b8 (patch) | |
| tree | 4ec1eeed4ea1071dad23da6be6c661c79e65ae11 /background_scripts | |
| parent | c781ce942e225c9bc9f172cea54e0e7de6e4bcd0 (diff) | |
| parent | 275f52fd23b1185a1d63c0143e5e6dbea8b90a73 (diff) | |
| download | vimium-3e3ccbb5fc89af559dc67fd973abfe2cf1a2e5b8.tar.bz2 | |
Merge pull request #782 from deiga/patch-1
Added feature to duplicate current tab
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/commands.coffee | 4 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index d7c332f9..c6a3a770 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -98,7 +98,7 @@ Commands = historyNavigation: ["goBack", "goForward"] tabManipulation: - ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "removeTab", "restoreTab"] + ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "duplicateTab", "removeTab", "restoreTab"] misc: ["showHelp"] @@ -161,6 +161,7 @@ defaultKeyMappings = "g$": "lastTab" "t": "createTab" + "yt": "duplicateTab" "x": "removeTab" "X": "restoreTab" @@ -232,6 +233,7 @@ commandDescriptions = firstTab: ["Go to the first tab", { background: true }] lastTab: ["Go to the last tab", { background: true }] createTab: ["Create new tab", { background: true }] + duplicateTab: ["Duplicate current tab", { background: true }] removeTab: ["Close current tab", { background: true }] restoreTab: ["Restore closed tab", { background: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index d9229f12..03c2277a 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -218,6 +218,10 @@ repeatFunction = (func, totalCount, currentCount, frameId) -> # mapped in commands.coffee. BackgroundCommands = createTab: (callback) -> chrome.tabs.create({ url: "chrome://newtab" }, (tab) -> callback()) + duplicateTab: (callback) -> + chrome.tabs.getSelected(null, (tab) -> + chrome.tabs.duplicate(tab.id) + selectionChangedHandlers.push(callback)) nextTab: (callback) -> selectTab(callback, "next") previousTab: (callback) -> selectTab(callback, "previous") firstTab: (callback) -> selectTab(callback, "first") |
