From 8065c547042d0ecf1d3da5339ed1f34237693a77 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 6 Mar 2017 03:21:44 +0100 Subject: Add keyboard shortcut URL files can now be downloaded using a keyboard shortcut so you don't have to move the mouse and click the button to do it. Only tested this on Mac. Decided on Ctrl-l as the default, which can be customised at `chrome://extensions/configureCommands`. Wanted something with only a single modifier key that wasn't going to clash with another command. The "Ctrl" string on Mac automatically gets converted to "Apple", so using "MacCtrl" to get the real "Ctrl" key. --- background.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'background.js') diff --git a/background.js b/background.js index b87bd04..393de06 100644 --- a/background.js +++ b/background.js @@ -51,4 +51,12 @@ chrome.browserAction.onClicked.addListener(function(tab) { openOrFocusOptionsPage(); } }); +}); + + +// Handle keyboard shortcut +chrome.commands.onCommand.addListener(function(command) { + if (command === 'download') { + download_backup_file(); + } }); \ No newline at end of file -- cgit v1.2.3