From 18b3419ad43ed06b88f26b30487002da4866b92d Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 24 Nov 2017 11:39:42 +0000 Subject: Add window and incognito options for createTab. Examples: # Just create new windows map X createTab window map X createTab incognito # Create windows with URLs map X createTab window https://developer.chrome.com/home https://github.com/philc/vimium map X createTab window URL1 URL2 URL3 `2X` creates two new windows, each with all of the indicated URLs. Fixes #2825. --- background_scripts/main.coffee | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 8f095ef1..4e36907a 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -188,13 +188,20 @@ BackgroundCommands = [if request.tab.incognito then "chrome://newtab" else chrome.runtime.getURL newTabUrl] else [newTabUrl] - urls = request.urls[..].reverse() - do openNextUrl = (request) -> - if 0 < urls.length - TabOperations.openUrlInNewTab (extend request, {url: urls.pop()}), (tab) -> - openNextUrl extend request, {tab, tabId: tab.id} - else - callback request + if request.registryEntry.options.incognito or request.registryEntry.options.window + windowConfig = + url: request.urls + focused: true + incognito: request.registryEntry.options.incognito ? false + chrome.windows.create windowConfig, -> callback request + else + urls = request.urls[..].reverse() + do openNextUrl = (request) -> + if 0 < urls.length + TabOperations.openUrlInNewTab (extend request, {url: urls.pop()}), (tab) -> + openNextUrl extend request, {tab, tabId: tab.id} + else + callback request duplicateTab: mkRepeatCommand (request, callback) -> chrome.tabs.duplicate request.tabId, (tab) -> callback extend request, {tab, tabId: tab.id} moveTabToNewWindow: ({count, tab}) -> -- cgit v1.2.3