From 6487c09d98b791b3211679d2f1bf970394a696e6 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 27 Feb 2016 16:05:23 +0000 Subject: Key bindings; rewire vomnibar. --- background_scripts/commands.coffee | 14 +++++++------- background_scripts/main.coffee | 11 ++++++++++- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 7e02047c..a62c674e 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -374,13 +374,13 @@ commandDescriptions = moveTabLeft: ["Move tab to the left", { background: true, passCountToFunction: true }] moveTabRight: ["Move tab to the right", { background: true, passCountToFunction: true }] - "Vomnibar.activate": ["Open URL, bookmark, or history entry", { noRepeat: true }] - "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { noRepeat: true }] - "Vomnibar.activateTabSelection": ["Search through your open tabs", { noRepeat: true }] - "Vomnibar.activateBookmarks": ["Open a bookmark", { noRepeat: true }] - "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { noRepeat: true }] - "Vomnibar.activateEditUrl": ["Edit the current URL", { noRepeat: true }] - "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { noRepeat: true }] + "Vomnibar.activate": ["Open URL, bookmark, or history entry", { background: true, noRepeat: true }] + "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { background: true, noRepeat: true }] + "Vomnibar.activateTabSelection": ["Search through your open tabs", { background: true, noRepeat: true }] + "Vomnibar.activateBookmarks": ["Open a bookmark", { background: true, noRepeat: true }] + "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { background: true, noRepeat: true }] + "Vomnibar.activateEditUrl": ["Edit the current URL", { background: true, noRepeat: true }] + "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { background: true, noRepeat: true }] nextFrame: ["Cycle forward to the next frame on the page", { background: true, passCountToFunction: true }] mainFrame: ["Select the tab's main/top frame", { background: true, noRepeat: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 60c161f9..8d2b4248 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -369,7 +369,16 @@ chrome.tabs.onUpdated.addListener (tabId, changeInfo, tab) -> # End action functions -runBackgroundCommand = ({frameId, registryEntry, count}) -> +# Open Vomnibar in tab's main frame. +openVomnibar = (tabId, frameId, registryEntry) -> + chrome.tabs.sendMessage tabId, + name: "openVomnibar" + sourceFrameId: frameId + registryEntry: registryEntry + +runBackgroundCommand = ({frameId, registryEntry, count}, sender) -> + if registryEntry.command.split(".")[0] == "Vomnibar" + openVomnibar sender.tab.id, frameId, registryEntry if registryEntry.passCountToFunction BackgroundCommands[registryEntry.command] count, frameId else if registryEntry.noRepeat -- cgit v1.2.3