From 795f5c25ec5e6a517ff9d12ac8a731d4a2881e68 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 9 Sep 2021 23:47:56 +0200 Subject: Add a keyboard shortcut to reload the extension On Firefox, when adding or modifying CSS files, the changes aren't applied on a page refresh. Instead, they're applied when the extension is reloaded. Provide a keyboard shortcut to enable quick reloads, rather than having to open `about:addons` and toggle the extension off and on. --- background.js | 8 ++++++++ manifest.json | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/background.js b/background.js index bd2be70..558fb55 100644 --- a/background.js +++ b/background.js @@ -69,3 +69,11 @@ function wildcard_domains (hostname) { return domains; } + + +// Keyboard shortcuts. +browser.commands.onCommand.addListener(function(command) { + if (command === 'reload') { + browser.runtime.reload(); + } +}); diff --git a/manifest.json b/manifest.json index cbc5413..f561dfb 100644 --- a/manifest.json +++ b/manifest.json @@ -29,5 +29,16 @@ "webNavigation", "http://*/*", "https://*/*" - ] + ], + + "commands": { + "reload": { + "suggested_key": { + "default": "Ctrl+Alt+L", + "mac": "MacCtrl+Alt+L" + }, + + "description": "Reload the extension" + } + } } -- cgit v1.2.3 From dd35d8da997dd3fa9f9eb3c749cb13cbc5215131 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 9 Sep 2021 23:55:45 +0200 Subject: manifest.json: Remove `activeTab` permission We already request permission on all `http://` and `https://` hosts. That should give us all the permission we need. The `activeTab` permission just seems redundant. It's probably a holdover that no longer applies. --- manifest.json | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.json b/manifest.json index f561dfb..3e231d4 100644 --- a/manifest.json +++ b/manifest.json @@ -25,7 +25,6 @@ }, "permissions": [ - "activeTab", "webNavigation", "http://*/*", "https://*/*" -- cgit v1.2.3