aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.markdown1
-rw-r--r--background_scripts/commands.coffee4
-rw-r--r--background_scripts/main.coffee4
3 files changed, 8 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index e8c22e1f..fb68bfd4 100644
--- a/README.markdown
+++ b/README.markdown
@@ -70,6 +70,7 @@ Manipulating tabs:
g0 go to the first tab
g$ go to the last tab
t create tab
+ yt duplicate current tab
x close current tab
X restore closed tab (i.e. unwind the 'x' command)
T search through your open tabs
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index a4937c4a..1db7d980 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"]
@@ -162,6 +162,7 @@ defaultKeyMappings =
"g$": "lastTab"
"t": "createTab"
+ "yt": "duplicateTab"
"x": "removeTab"
"X": "restoreTab"
@@ -234,6 +235,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")