diff options
| -rw-r--r-- | background_scripts/main.coffee | 9 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 | ||||
| -rw-r--r-- | pages/options.html | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index a6e5a4eb..f70cd8f3 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -246,7 +246,14 @@ moveTab = (callback, direction) -> # These are commands which are bound to keystroke which must be handled by the background page. They are # mapped in commands.coffee. BackgroundCommands = - createTab: (callback) -> openUrlInNewTab { url: Settings.get("newTabUrl") }, callback + createTab: (callback) -> + chrome.tabs.query { active: true, currentWindow: true }, (tabs) -> + tab = tabs[0] + url = Settings.get "newTabUrl" + if url == "pages/blank.html" + # "pages/blank.html" does not work in incognito mode, so fall back to "chrome://newtab" instead. + url = if tab.incognito then "chrome://newtab" else chrome.runtime.getURL url + openUrlInNewTab { url }, callback duplicateTab: (callback) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.duplicate(tab.id) diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index d0fc158c..f3bbb868 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -189,7 +189,6 @@ initializePreDomReady = -> # Ensure the sendResponse callback is freed. false - # Wrapper to install event listeners. Syntactic sugar. installListener = (element, event, callback) -> element.addEventListener(event, -> @@ -223,6 +222,9 @@ onFocus = (event) -> settings.load() chrome.runtime.sendMessage handler: "frameFocused", frameId: frameId, url: window.location.toString() checkIfEnabledForUrl() + +# We install this listener directly (that is, we don't use installListener) because we still need to receive +# events when Vimium is not enabled. window.addEventListener "focus", onFocus # diff --git a/pages/options.html b/pages/options.html index 889d5ea0..f89ddcbb 100644 --- a/pages/options.html +++ b/pages/options.html @@ -200,7 +200,7 @@ b: http://b.com/?q=%s description <div class="help"> <div class="example"> The page to open with the "create new tab" command. - Set this to "<tt>pages/blank.html</tt>" for a blank page.<br /> + Set this to "<tt>pages/blank.html</tt>" for a blank page (except incognito mode).<br /> </div> </div> <input id="newTabUrl" type="text" /> |
