aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/commands.coffee4
-rw-r--r--background_scripts/main.coffee4
2 files changed, 7 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index d7c332f9..92d2a40d 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", "openTabInNewWindow", "removeTab", "restoreTab"]
misc:
["showHelp"]
@@ -160,6 +160,7 @@ defaultKeyMappings =
"g0": "firstTab"
"g$": "lastTab"
+ "w": "openTabInNewWindow"
"t": "createTab"
"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 }]
+ openTabInNewWindow: ["Open tab in new window", { 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..912117ff 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())
+ openTabInNewWindow: (callback) ->
+ chrome.tabs.getSelected(null, (tab) ->
+ chrome.windows.create({tabId: tab.id})
+ selectionChangedHandlers.push(callback))
nextTab: (callback) -> selectTab(callback, "next")
previousTab: (callback) -> selectTab(callback, "previous")
firstTab: (callback) -> selectTab(callback, "first")