diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 4a626d365..ec49a81b6 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -116,6 +116,8 @@ Commands = "LinkHints.activateModeToOpenInNewTab", "LinkHints.activateModeToOpenInNewForegroundTab", "LinkHints.activateModeWithQueue", + "LinkHints.activateModeToOpenInNewWindow", + "LinkHints.activateModeToOpenInNewFullscreenWindow", "LinkHints.activateModeToDownloadLink", "Vomnibar.activate", "Vomnibar.activateInNewTab", @@ -165,6 +167,8 @@ Commands = "Vomnibar.activateEditUrl", "Vomnibar.activateEditUrlInNewTab", "LinkHints.activateModeToOpenIncognito", + "LinkHints.activateModeToOpenInNewWindow", + "LinkHints.activateModeToOpenInNewFullscreenWindow", "goNext", "goPrevious", "Marks.activateCreateMode", @@ -292,6 +296,8 @@ commandDescriptions = "LinkHints.activateModeToOpenInNewTab": ["Open a link in a new tab", { noRepeat: true }] "LinkHints.activateModeToOpenInNewForegroundTab": ["Open a link in a new tab & switch to it", { noRepeat: true }] "LinkHints.activateModeWithQueue": ["Open multiple links in a new tab", { noRepeat: true }] + "LinkHints.activateModeToOpenInNewWindow": ["Open a link in a new window", { noRepeat: true }] + "LinkHints.activateModeToOpenInNewFullscreenWindow": ["Open a link in a fullscreen window", { noRepeat: true }] "LinkHints.activateModeToOpenIncognito": ["Open a link in incognito window", { noRepeat: true }] "LinkHints.activateModeToDownloadLink": ["Download link url", { noRepeat: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 898f46f16..c3ef24688 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -167,8 +167,18 @@ openUrlInNewTab = (request) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true })) +# +# Opens request.url in new incognito window. +# openUrlInIncognito = (request) -> - chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true}) + chrome.windows.create({url: Utils.convertToUrl(request.url), incognito: true}) + +# +# Opens request.url in new fullscreen window. +# +openUrlInFullscreen = (request) -> + chrome.windows.create({url: Utils.convertToUrl(request.url)}, (window) -> + chrome.windows.update window.id, {state: "fullscreen"}) # # Called when the user has clicked the close icon on the "Vimium has been updated" message. @@ -631,6 +641,7 @@ sendRequestHandlers = getCurrentTabUrl: getCurrentTabUrl, openUrlInNewTab: openUrlInNewTab, openUrlInIncognito: openUrlInIncognito, + openUrlInFullscreen: openUrlInFullscreen, openUrlInCurrentTab: openUrlInCurrentTab, openOptionsPageInNewTab: openOptionsPageInNewTab, registerFrame: registerFrame, diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 24bd7126a..0de7ed124 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -15,6 +15,8 @@ OPEN_WITH_QUEUE = {} COPY_LINK_URL = {} OPEN_INCOGNITO = {} DOWNLOAD_LINK_URL = {} +OPEN_IN_NEW_WINDOW = {} +OPEN_IN_NEW_FULLSCREEN_WINDOW = {} LinkHints = hintMarkerContainingDiv: null @@ -53,6 +55,8 @@ LinkHints = activateModeToCopyLinkUrl: -> @activateMode(COPY_LINK_URL) activateModeWithQueue: -> @activateMode(OPEN_WITH_QUEUE) activateModeToOpenIncognito: -> @activateMode(OPEN_INCOGNITO) + activateModeToOpenInNewWindow: -> @activateMode(OPEN_IN_NEW_WINDOW) + activateModeToOpenInNewFullscreenWindow: -> @activateMode(OPEN_IN_NEW_FULLSCREEN_WINDOW) activateModeToDownloadLink: -> @activateMode(DOWNLOAD_LINK_URL) activateMode: (mode = OPEN_IN_CURRENT_TAB) -> @@ -115,6 +119,18 @@ LinkHints = altKey: true, ctrlKey: false, metaKey: false }) + else if @mode is OPEN_IN_NEW_FULLSCREEN_WINDOW + HUD.show("Open link in fullscreen window") + + @linkActivator = (link) -> + chrome.runtime.sendMessage( + handler: 'openUrlInFullscreen' + url: link.href) + else if @mode is OPEN_IN_NEW_WINDOW + HUD.show("Open link in new window") + + @linkActivator = (link) -> + DomUtils.simulateClick(link, {shiftKey: true}) else # OPEN_IN_CURRENT_TAB HUD.show("Open link in current tab") @linkActivator = (link) -> DomUtils.simulateClick.bind(DomUtils, link)()