diff options
| author | Stephen Blott | 2017-11-24 11:39:42 +0000 |
|---|---|---|
| committer | Stephen Blott | 2017-11-24 11:39:44 +0000 |
| commit | 18b3419ad43ed06b88f26b30487002da4866b92d (patch) | |
| tree | 334ad3a27f7cb4ec9ca5d6a586791bc36e75c7e6 | |
| parent | 138a7b00d2458d34fdea4c00ae59f7bbfdc57c6f (diff) | |
| download | vimium-18b3419ad43ed06b88f26b30487002da4866b92d.tar.bz2 | |
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.
| -rw-r--r-- | background_scripts/main.coffee | 21 |
1 files 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}) -> |
