Browse Source

feat: shortcut for element selector

Ahmad Kholid 2 years ago
parent
commit
d5b3cdc440
3 changed files with 24 additions and 5 deletions
  1. 6 1
      src/background/BackgroundEventsListeners.js
  2. 8 1
      src/manifest.chrome.json
  3. 10 3
      src/manifest.firefox.json

+ 6 - 1
src/background/BackgroundEventsListeners.js

@@ -1,4 +1,5 @@
 import browser from 'webextension-polyfill';
+import { initElementSelector } from '@/newtab/utils/elementSelector';
 import BackgroundUtils from './BackgroundUtils';
 import BackgroundWorkflowTriggers from './BackgroundWorkflowTriggers';
 
@@ -8,7 +9,11 @@ class BackgroundEventsListeners {
   }
 
   static onCommand(name) {
-    if (name === 'open-dashboard') BackgroundUtils.openDashboard();
+    if (name === 'open-dashboard') {
+      BackgroundUtils.openDashboard();
+    } else if (name === 'element-picker') {
+      initElementSelector();
+    }
   }
 
   static onAlarms(event) {

+ 8 - 1
src/manifest.chrome.json

@@ -18,7 +18,14 @@
         "default": "Alt+A",
         "mac": "Alt+A"
       },
-      "description": "Open the Automa dashboard"
+      "description": "Open the dashboard"
+    },
+    "element-picker": {
+      "suggested_key": {
+        "default": "Alt+P",
+        "mac": "Alt+P"
+      },
+      "description": "Open element picker"
     }
   },
   "content_scripts": [

+ 10 - 3
src/manifest.firefox.json

@@ -20,10 +20,17 @@
   "commands": {
     "open-dashboard": {
       "suggested_key": {
-        "default": "Ctrl+Shift+A",
-        "mac": "MacCtrl+Shift+A"
+        "default": "Alt+A",
+        "mac": "Alt+A"
       },
-      "description": "Open the Automa dashboard"
+      "description": "Open the dashboard"
+    },
+    "element-picker": {
+      "suggested_key": {
+        "default": "Alt+P",
+        "mac": "Alt+P"
+      },
+      "description": "Open element picker"
     }
   },
   "content_scripts": [