{
  "name": "Clipboard History",
  "version": 1,
  "nodes": [
    {
      "localID": 0,
      "typeID": "trigger.clipboard",
      "customName": "Clipboard Changed",
      "isDisabled": false,
      "x": 60.0,
      "y": 120.0,
      "config": {
        "saveImages": true,
        "customArgs": {}
      }
    },
    {
      "localID": 1,
      "typeID": "condition.compare",
      "customName": "Worth keeping?",
      "isDisabled": false,
      "x": 380.0,
      "y": 120.0,
      "config": {
        "rules": [
          {
            "field": "types",
            "operator": "contains",
            "value": "org.nspasteboard.ConcealedType",
            "negate": true
          },
          {
            "field": "types",
            "operator": "contains",
            "value": "org.nspasteboard.TransientType",
            "negate": true
          },
          {
            "field": "contentType",
            "operator": "not_equals",
            "value": "other",
            "negate": false
          }
        ],
        "logic": "and",
        "caseInsensitive": false
      }
    },
    {
      "localID": 2,
      "typeID": "action.database_insert",
      "customName": "Save the clip",
      "isDisabled": false,
      "x": 700.0,
      "y": 120.0,
      "config": {
        "databaseId": "SMOKE_DB",
        "databaseName": "Clipboard History",
        "table": "clips",
        "fields": [
          {
            "column": "body",
            "value": "{{text}}"
          },
          {
            "column": "kind",
            "value": "{{contentType}}"
          },
          {
            "column": "image_path",
            "value": "{{imagePath}}"
          }
        ],
        "autoCreate": true,
        "conflict": "abort"
      }
    },
    {
      "localID": 3,
      "typeID": "trigger.keyboard_shortcut",
      "customName": "Control-Option-V",
      "isDisabled": false,
      "x": 60.0,
      "y": 440.0,
      "config": {
        "shortcut": "ctrl+option+v",
        "consumeKey": true,
        "customArgs": {}
      }
    },
    {
      "localID": 4,
      "typeID": "action.database_sql",
      "customName": "Recent clips",
      "isDisabled": false,
      "x": 380.0,
      "y": 440.0,
      "config": {
        "databaseId": "SMOKE_DB",
        "databaseName": "Clipboard History",
        "sql": "SELECT *,\n  CASE WHEN kind = 'image' THEN 'Image'\n       ELSE substr(trim(replace(body, char(10), ' ')), 1, 120)\n  END AS preview,\n  datetime(created_at, 'localtime') AS copied_at\nFROM clips\nWHERE id IN (\n  SELECT max(id) FROM clips\n  GROUP BY CASE WHEN kind = 'image' THEN id ELSE body END\n)\nORDER BY id DESC\nLIMIT 300"
      }
    },
    {
      "localID": 5,
      "typeID": "action.palette",
      "customName": "Pick a clip",
      "isDisabled": false,
      "x": 700.0,
      "y": 440.0,
      "config": {
        "rowsKey": "records",
        "view": "list",
        "primaryColumn": "preview",
        "secondaryColumn": "copied_at",
        "thumbnailColumn": "image_path",
        "searchColumns": [
          "body"
        ],
        "placeholder": "Paste an earlier clip…"
      }
    },
    {
      "localID": 6,
      "typeID": "condition.compare",
      "customName": "Image?",
      "isDisabled": false,
      "x": 1020.0,
      "y": 440.0,
      "config": {
        "rules": [
          {
            "field": "selected.kind",
            "operator": "equals",
            "value": "image",
            "negate": false
          }
        ],
        "logic": "and",
        "caseInsensitive": false
      }
    },
    {
      "localID": 7,
      "typeID": "action.copy_to_clipboard",
      "customName": "Copy the image",
      "isDisabled": false,
      "x": 1340.0,
      "y": 370.0,
      "config": {
        "mode": "file",
        "text": "",
        "filePath": "{{selected.image_path}}"
      }
    },
    {
      "localID": 8,
      "typeID": "action.copy_to_clipboard",
      "customName": "Copy the text",
      "isDisabled": false,
      "x": 1340.0,
      "y": 530.0,
      "config": {
        "mode": "text",
        "text": "{{selected.body}}",
        "filePath": ""
      }
    },
    {
      "localID": 9,
      "typeID": "action.simulate_keys",
      "customName": "Paste",
      "isDisabled": false,
      "x": 1660.0,
      "y": 440.0,
      "config": {
        "shortcut": "cmd+v"
      }
    },
    {
      "localID": 10,
      "typeID": "trigger.schedule",
      "customName": "Every day at noon",
      "isDisabled": false,
      "x": 60.0,
      "y": 800.0,
      "config": {
        "mode": "calendar",
        "weekdays": "mon,tue,wed,thu,fri,sat,sun",
        "time": "12:00",
        "customArgs": {}
      }
    },
    {
      "localID": 11,
      "typeID": "action.database_delete",
      "customName": "Forget old clips",
      "isDisabled": false,
      "x": 380.0,
      "y": 800.0,
      "config": {
        "databaseId": "SMOKE_DB",
        "databaseName": "Clipboard History",
        "table": "clips",
        "where": [
          {
            "column": "created_at",
            "operator": "older_than_days",
            "value": "30"
          }
        ],
        "whereLogic": "and",
        "allRows": false,
        "caseSensitive": false
      }
    },
    {
      "localID": 12,
      "typeID": "note",
      "customName": "Remember",
      "isDisabled": false,
      "x": 20.0,
      "y": 40.0,
      "config": {
        "backdrop": true,
        "color": "#64B5F6",
        "text": "Remember every copy",
        "_width": 1000.0,
        "_height": 240.0
      }
    },
    {
      "localID": 13,
      "typeID": "note",
      "customName": "Paste",
      "isDisabled": false,
      "x": 20.0,
      "y": 320.0,
      "config": {
        "backdrop": true,
        "color": "#81C784",
        "text": "Paste an earlier one",
        "_width": 1920.0,
        "_height": 380.0
      }
    },
    {
      "localID": 14,
      "typeID": "note",
      "customName": "Forget",
      "isDisabled": false,
      "x": 20.0,
      "y": 730.0,
      "config": {
        "backdrop": true,
        "color": "#FFB74D",
        "text": "Forget after 30 days",
        "_width": 680.0,
        "_height": 220.0
      }
    }
  ],
  "connections": [
    {
      "sourceLocalID": 0,
      "sourcePortID": "outlet_output",
      "targetLocalID": 1,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 1,
      "sourcePortID": "outlet_yes",
      "targetLocalID": 2,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 3,
      "sourcePortID": "outlet_output",
      "targetLocalID": 4,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 4,
      "sourcePortID": "outlet_output",
      "targetLocalID": 5,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 5,
      "sourcePortID": "outlet_selected",
      "targetLocalID": 6,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 6,
      "sourcePortID": "outlet_yes",
      "targetLocalID": 7,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 6,
      "sourcePortID": "outlet_no",
      "targetLocalID": 8,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 7,
      "sourcePortID": "outlet_output",
      "targetLocalID": 9,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 8,
      "sourcePortID": "outlet_output",
      "targetLocalID": 9,
      "targetPortID": "inlet_input"
    },
    {
      "sourceLocalID": 10,
      "sourcePortID": "outlet_output",
      "targetLocalID": 11,
      "targetPortID": "inlet_input"
    }
  ],
  "background": {
    "type": "image",
    "ref": {
      "type": "bundled",
      "id": "graphite"
    },
    "fit": "cover"
  }
}
