summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/search.js11
-rw-r--r--ext/manifest.json4
2 files changed, 13 insertions, 2 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 8484e042..a09ca822 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -85,7 +85,16 @@ class DisplaySearch extends Display {
if (this.clipboardMonitorEnable !== null) {
this.clipboardMonitorEnable.addEventListener('change', (e) => {
if (e.target.checked) {
- this.startClipboardMonitor();
+ chrome.permissions.request(
+ {permissions: ['clipboardRead']},
+ (granted) => {
+ if (granted) {
+ this.startClipboardMonitor();
+ } else {
+ e.target.checked = false;
+ }
+ }
+ );
} else {
this.stopClipboardMonitor();
}
diff --git a/ext/manifest.json b/ext/manifest.json
index 2b7fc105..6390cbfb 100644
--- a/ext/manifest.json
+++ b/ext/manifest.json
@@ -41,10 +41,12 @@
"permissions": [
"<all_urls>",
"storage",
- "clipboardRead",
"clipboardWrite",
"unlimitedStorage"
],
+ "optional_permissions": [
+ "clipboardRead"
+ ],
"commands": {
"toggle": {
"suggested_key": {