{
  "$schema": "https://raw.githubusercontent.com/jopemachine/arvis-extension-validator/master/workflow-schema.json",
  "defaultIcon": "icon.png",
  "category": "Productivity",
  "creator": "jopemachine",
  "description": "Chrome kernel based broswer workflow for Arvis 4",
  "name": "arvis-chrome-workflow",
  "readme": "https://github.com/jopemachine/arvis-chrome-workflow",
  "version": "0.0.5",
  "webAddress": "https://github.com/jopemachine/arvis-chrome-workflow",
  "enabled": true,
  "commands": [
      {
          "type": "keyword",
          "command": "ch > init",
          "subtitle": "",
          "argType": "no",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "script",
                  "script": "node src/init.js"
              }
          ]
      },
      {
          "type": "keyword",
          "command": "ch > cache",
          "subtitle": "Cache favicon images in advance from visit history",
          "argType": "no",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "script",
                  "script": "node src/cacheFavicons.js '{query}'",
                  "actions": [
                      {
                          "modifiers": "normal",
                          "type": "notification",
                          "title": "Caching completed successfully",
                          "text": ""
                      }
                  ]
              }
          ]
      },
      {
          "type": "keyword",
          "command": "ch > clearcache",
          "subtitle": "Clean favicon cache",
          "argType": "no",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "script",
                  "script": "node src/clearCache.js",
                  "actions": [
                      {
                          "modifiers": "normal",
                          "type": "notification",
                          "title": "Cache cleared",
                          "text": ""
                      }
                  ]
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chs",
          "title": "chs",
          "subtitle": "Search chrome queries",
          "scriptFilter": "node src/chromeSearch.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "args",
                  "arg": "{var:type}",
                  "actions": [
                      {
                          "modifiers": "normal",
                          "type": "cond",
                          "if": {
                              "cond": "new RegExp(\".*url.*\").test({query})",
                              "actions": {
                                  "then": [
                                      {
                                          "modifiers": "normal",
                                          "type": "open",
                                          "target": "{var:url}"
                                      }
                                  ],
                                  "else": [
                                      {
                                          "modifiers": "normal",
                                          "type": "open",
                                          "target": "https://www.google.com/search?q={var:query}"
                                      }
                                  ]
                              }
                          }
                      }
                  ]
              },
              {
                  "modifiers": "cmd",
                  "type": "args",
                  "arg": "{var:type}",
                  "actions": [
                      {
                          "modifiers": "normal",
                          "type": "cond",
                          "if": {
                              "cond": "new RegExp(\".*url.*\").test({query})",
                              "actions": {
                                  "then": [
                                      {
                                          "modifiers": "normal",
                                          "type": "clipboard",
                                          "text": "{var:url}"
                                      }
                                  ],
                                  "else": [
                                      {
                                          "modifiers": "normal",
                                          "type": "clipboard",
                                          "text": "https://www.google.com/search?q={var:query}"
                                      }
                                  ]
                              }
                          }
                      }
                  ]
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "ch > conf",
          "title": "ch > conf",
          "subtitle": "Open config file",
          "scriptFilter": "node src/openConf.js",
          "runningSubtext": "",
          "withspace": false,
          "argType": "no",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "open",
                  "target": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chb",
          "title": "chb",
          "subtitle": "Search chrome bookmark",
          "scriptFilter": "node src/fetchBookmark.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "open",
                  "target": "{query}"
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "title": "",
          "subtitle": "Search chrome bookmark",
          "scriptFilter": "node src/fetchBookmark.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "cond",
                  "if": {
                      "cond": "{query} == \"back\"",
                      "actions": {
                          "then": [],
                          "else": [
                              {
                                  "modifiers": "normal",
                                  "type": "open",
                                  "target": "{query}"
                              }
                          ]
                      }
                  }
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chf",
          "title": "chf",
          "subtitle": "Search chrome bookmark folder",
          "scriptFilter": "node src/fetchBookmarkFolder.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "args",
                  "arg": "{var:folder} ",
                  "actions": [
                      {
                          "modifiers": "normal",
                          "title": "",
                          "type": "scriptFilter",
                          "scriptFilter": "node src/fetchBookmark.js '{query}'",
                          "runningSubtext": "Searching...",
                          "withspace": true,
                          "actions": [
                              {
                                  "modifiers": "normal",
                                  "type": "cond",
                                  "if": {
                                      "cond": "{query} == \"back\"",
                                      "actions": {
                                          "then": [],
                                          "else": [
                                              {
                                                  "modifiers": "normal",
                                                  "type": "open",
                                                  "target": "{query}"
                                              }
                                          ]
                                      }
                                  }
                              },
                              {
                                  "modifiers": "cmd",
                                  "type": "clipboard",
                                  "text": "{query}"
                              }
                          ]
                      }
                  ]
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chm",
          "title": "chm",
          "subtitle": "Search chrome media history",
          "scriptFilter": "node src/fetchPlaybackSession.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "open",
                  "target": "{query}"
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chh",
          "title": "chh",
          "subtitle": "Search chrome history",
          "scriptFilter": "node src/fetchHistory.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "open",
                  "target": "{query}"
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "cha",
          "title": "cha",
          "subtitle": "Search chrome autofill data",
          "scriptFilter": "node src/fetchAutofillData.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "clipboard",
                  "text": "{query}",
                  "actions": []
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      },
      {
          "type": "scriptFilter",
          "command": "chd",
          "title": "chd",
          "subtitle": "Search chrome download history",
          "scriptFilter": "node src/fetchDownloadHistory.js '{query}'",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": []
      },
      {
          "type": "scriptFilter",
          "command": "chid",
          "title": "chid",
          "subtitle": "Search chrome user id",
          "scriptFilter": "node src/fetchLoginData.js '{query}' --type=userId",
          "runningSubtext": "Searching...",
          "withspace": true,
          "argType": "optional",
          "actions": [
              {
                  "modifiers": "normal",
                  "type": "clipboard",
                  "text": "{query}",
                  "actions": []
              },
              {
                  "modifiers": "cmd",
                  "type": "clipboard",
                  "text": "{query}"
              }
          ]
      }
  ]
}