aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-03-06 03:21:44 +0100
committerTeddy Wing2017-03-06 03:21:44 +0100
commit8065c547042d0ecf1d3da5339ed1f34237693a77 (patch)
treec4aaaacd3e816022a7f499efba664d4a2ed55243
parent11bd4c0ddc4047e78ef3bb850f728aa4917110c4 (diff)
downloadchrome-copy-urls-from-all-tabs-8065c547042d0ecf1d3da5339ed1f34237693a77.tar.bz2
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.
-rw-r--r--background.js8
-rw-r--r--manifest.json11
2 files changed, 18 insertions, 1 deletions
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
diff --git a/manifest.json b/manifest.json
index 1dca7ac..84c65c8 100644
--- a/manifest.json
+++ b/manifest.json
@@ -28,5 +28,14 @@
"permissions": [
"tabs",
"storage"
- ]
+ ],
+
+ "commands": {
+ "download": {
+ "suggested_key": {
+ "default": "MacCtrl+L"
+ },
+ "description": "Download URL file"
+ }
+ }
}