{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "quick-shot",
        "name": "Quick Shot",
        "version": 1,
        "schema": "tailapps/v0",
        "exported_at": 1795564615,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "f27bd9fef56409d5f56ec36ff961e9f798bdce08de02084ccd2527a40c36875e"
        },
        "signature": "xz54m9HUlDyz5cat3AKV/sY4/uS71Ot88ypgqMwjkJt+6WpL1ks4bOuCA/gmW9l/eRHu3hgVLFRE18ZVJkpYBg==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "quick-shot",
        "name": "Quick Shot",
        "description": "Grab a screen region, copy it and pull out the text; saves to a folder or a bucket, and can send each shot to your iPhone.",
        "icon": "camera.viewfinder",
        "permissions": [
            "screen.capture",
            "vision.ocr",
            "clipboard.write",
            "files.write:dest",
            "inbox:shots",
            "send:shots"
        ],
        "settings": {
            "dest": {
                "type": "storage",
                "label": "Save shots to",
                "default": "~/Pictures/Quick Shot",
                "create": true,
                "required": true,
                "platforms": [
                    "macos"
                ]
            },
            "to_devices": {
                "type": "toggle",
                "label": "Also send shots to my other devices",
                "default": false,
                "platforms": [
                    "macos"
                ]
            }
        },
        "sources": {
            "incoming": {
                "inbox": "shots",
                "on_receive": "got_shot"
            }
        },
        "state": {
            "shots": {
                "type": "list",
                "default": []
            },
            "lastText": {
                "type": "text",
                "default": ""
            },
            "lastLink": {
                "type": "text",
                "default": ""
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "button": "Grab region",
                            "on": "grab",
                            "style": "primary",
                            "disabled": "$running.grab",
                            "keys": "mod+g"
                        },
                        {
                            "gallery": "$shots",
                            "limit": 3,
                            "height": "m",
                            "thumb": "$item.thumb",
                            "on_select": "copy_shot"
                        },
                        {
                            "text": "$lastText | default:'Grab a region to read its text.'",
                            "lines": 6,
                            "size": "s"
                        },
                        {
                            "row": [
                                {
                                    "button": "Copy text",
                                    "on": "copy_text",
                                    "style": "secondary",
                                    "disabled": "$lastText | count | map:{0:true, else:false}"
                                },
                                {
                                    "button": "Copy link",
                                    "on": "copy_link",
                                    "style": "secondary",
                                    "disabled": "$lastLink | count | map:{0:true, else:false}"
                                }
                            ],
                            "justify": "end"
                        }
                    ],
                    "gap": "m"
                }
            },
            {
                "id": "phone",
                "layout": {
                    "column": [
                        {
                            "gallery": "$shots",
                            "limit": 12,
                            "height": "m",
                            "thumb": "$item.thumb",
                            "preview": true
                        },
                        {
                            "text": "Tap a shot to see it full size, then save or share it.",
                            "size": "s",
                            "emphasis": "subtle",
                            "when": "$shots"
                        },
                        {
                            "text": "Shots you grab on your Mac show up here.",
                            "size": "s",
                            "emphasis": "subtle",
                            "when": "$shots | count | map:{0:true, else:false}"
                        },
                        {
                            "section": "Text in the last shot",
                            "collapsible": true,
                            "collapsed": true,
                            "when": "$lastText",
                            "children": [
                                {
                                    "text": "$lastText",
                                    "lines": 8,
                                    "size": "s"
                                },
                                {
                                    "row": [
                                        {
                                            "button": "Copy text",
                                            "on": "copy_text",
                                            "style": "secondary"
                                        }
                                    ],
                                    "justify": "end"
                                }
                            ]
                        }
                    ],
                    "gap": "m"
                }
            }
        ],
        "actions": {
            "grab": {
                "steps": [
                    {
                        "screen.capture": {
                            "mode": "region"
                        },
                        "as": "img"
                    },
                    {
                        "files.save": {
                            "data": "$img",
                            "to": "$settings.dest",
                            "name": "shot-{$now}.png"
                        },
                        "as": "saved"
                    },
                    {
                        "vision.ocr": "$img",
                        "as": "text"
                    },
                    {
                        "clipboard.write": {
                            "image": "$img"
                        }
                    },
                    {
                        "set": {
                            "lastText": "$text",
                            "lastLink": "$saved.url"
                        }
                    },
                    {
                        "if": "$saved.path",
                        "then": [
                            {
                                "push": {
                                    "shots": {
                                        "thumb": "$saved.path",
                                        "url": "$saved.url",
                                        "kind": "$saved.kind"
                                    }
                                },
                                "max": 24
                            }
                        ],
                        "else": [
                            {
                                "push": {
                                    "shots": {
                                        "thumb": "$img",
                                        "url": "$saved.url",
                                        "kind": "$saved.kind"
                                    }
                                },
                                "max": 24
                            }
                        ]
                    },
                    {
                        "if": "$settings.to_devices",
                        "then": [
                            {
                                "send": {
                                    "shots": {
                                        "text": "$text",
                                        "link": "$saved.url",
                                        "at": "$now"
                                    }
                                },
                                "file": "$img",
                                "alert": "New screenshot"
                            }
                        ]
                    }
                ]
            },
            "got_shot": {
                "steps": [
                    {
                        "set": {
                            "lastText": "$args.event.text",
                            "lastLink": "$args.event.link"
                        }
                    },
                    {
                        "if": "$args.file",
                        "then": [
                            {
                                "push": {
                                    "shots": {
                                        "thumb": "$args.file",
                                        "url": "$args.event.link",
                                        "kind": "received"
                                    }
                                },
                                "max": 24
                            }
                        ]
                    }
                ]
            },
            "copy_text": {
                "steps": [
                    {
                        "clipboard.write": {
                            "text": "$lastText"
                        }
                    }
                ]
            },
            "copy_link": {
                "steps": [
                    {
                        "clipboard.write": {
                            "text": "$lastLink"
                        }
                    }
                ]
            },
            "copy_shot": {
                "steps": [
                    {
                        "if": "$args.item.kind | map:{s3:true, else:false}",
                        "then": [
                            {
                                "clipboard.write": {
                                    "text": "$args.item.url"
                                }
                            }
                        ],
                        "else": [
                            {
                                "clipboard.write": {
                                    "image": "$args.item.thumb"
                                }
                            }
                        ]
                    }
                ]
            }
        },
        "views": {
            "menubar": {
                "icon": "camera.viewfinder",
                "label": "{$shots | count} shots",
                "card": "main"
            },
            "floating": {
                "card": "main",
                "pin": true
            },
            "phone": {
                "card": "phone"
            }
        },
        "shortcuts": {
            "actions": {
                "grab": {
                    "keys": "ctrl+shift+2",
                    "scope": "global"
                }
            }
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"quick-shot\",\n  \"name\": \"Quick Shot\",\n  \"description\": \"Grab a screen region, copy it and pull out the text; saves to a folder or a bucket, and can send each shot to your iPhone.\",\n  \"icon\": \"camera.viewfinder\",\n  \"permissions\": [\n    \"screen.capture\",\n    \"vision.ocr\",\n    \"clipboard.write\",\n    \"files.write:dest\",\n    \"inbox:shots\",\n    \"send:shots\"\n  ],\n  \"settings\": {\n    \"dest\": {\n      \"type\": \"storage\",\n      \"label\": \"Save shots to\",\n      \"default\": \"~/Pictures/Quick Shot\",\n      \"create\": true,\n      \"required\": true,\n      \"platforms\": [\n        \"macos\"\n      ]\n    },\n    \"to_devices\": {\n      \"type\": \"toggle\",\n      \"label\": \"Also send shots to my other devices\",\n      \"default\": false,\n      \"platforms\": [\n        \"macos\"\n      ]\n    }\n  },\n  \"sources\": {\n    \"incoming\": {\n      \"inbox\": \"shots\",\n      \"on_receive\": \"got_shot\"\n    }\n  },\n  \"state\": {\n    \"shots\": {\n      \"type\": \"list\",\n      \"default\": []\n    },\n    \"lastText\": {\n      \"type\": \"text\",\n      \"default\": \"\"\n    },\n    \"lastLink\": {\n      \"type\": \"text\",\n      \"default\": \"\"\n    }\n  },\n  \"cards\": [\n    {\n      \"id\": \"main\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"button\": \"Grab region\",\n            \"on\": \"grab\",\n            \"style\": \"primary\",\n            \"disabled\": \"$running.grab\",\n            \"keys\": \"mod+g\"\n          },\n          {\n            \"gallery\": \"$shots\",\n            \"limit\": 3,\n            \"height\": \"m\",\n            \"thumb\": \"$item.thumb\",\n            \"on_select\": \"copy_shot\"\n          },\n          {\n            \"text\": \"$lastText | default:'Grab a region to read its text.'\",\n            \"lines\": 6,\n            \"size\": \"s\"\n          },\n          {\n            \"row\": [\n              {\n                \"button\": \"Copy text\",\n                \"on\": \"copy_text\",\n                \"style\": \"secondary\",\n                \"disabled\": \"$lastText | count | map:{0:true, else:false}\"\n              },\n              {\n                \"button\": \"Copy link\",\n                \"on\": \"copy_link\",\n                \"style\": \"secondary\",\n                \"disabled\": \"$lastLink | count | map:{0:true, else:false}\"\n              }\n            ],\n            \"justify\": \"end\"\n          }\n        ],\n        \"gap\": \"m\"\n      }\n    },\n    {\n      \"id\": \"phone\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"gallery\": \"$shots\",\n            \"limit\": 12,\n            \"height\": \"m\",\n            \"thumb\": \"$item.thumb\",\n            \"preview\": true\n          },\n          {\n            \"text\": \"Tap a shot to see it full size, then save or share it.\",\n            \"size\": \"s\",\n            \"emphasis\": \"subtle\",\n            \"when\": \"$shots\"\n          },\n          {\n            \"text\": \"Shots you grab on your Mac show up here.\",\n            \"size\": \"s\",\n            \"emphasis\": \"subtle\",\n            \"when\": \"$shots | count | map:{0:true, else:false}\"\n          },\n          {\n            \"section\": \"Text in the last shot\",\n            \"collapsible\": true,\n            \"collapsed\": true,\n            \"when\": \"$lastText\",\n            \"children\": [\n              {\n                \"text\": \"$lastText\",\n                \"lines\": 8,\n                \"size\": \"s\"\n              },\n              {\n                \"row\": [\n                  {\n                    \"button\": \"Copy text\",\n                    \"on\": \"copy_text\",\n                    \"style\": \"secondary\"\n                  }\n                ],\n                \"justify\": \"end\"\n              }\n            ]\n          }\n        ],\n        \"gap\": \"m\"\n      }\n    }\n  ],\n  \"actions\": {\n    \"grab\": {\n      \"steps\": [\n        {\n          \"screen.capture\": {\n            \"mode\": \"region\"\n          },\n          \"as\": \"img\"\n        },\n        {\n          \"files.save\": {\n            \"data\": \"$img\",\n            \"to\": \"$settings.dest\",\n            \"name\": \"shot-{$now}.png\"\n          },\n          \"as\": \"saved\"\n        },\n        {\n          \"vision.ocr\": \"$img\",\n          \"as\": \"text\"\n        },\n        {\n          \"clipboard.write\": {\n            \"image\": \"$img\"\n          }\n        },\n        {\n          \"set\": {\n            \"lastText\": \"$text\",\n            \"lastLink\": \"$saved.url\"\n          }\n        },\n        {\n          \"if\": \"$saved.path\",\n          \"then\": [\n            {\n              \"push\": {\n                \"shots\": {\n                  \"thumb\": \"$saved.path\",\n                  \"url\": \"$saved.url\",\n                  \"kind\": \"$saved.kind\"\n                }\n              },\n              \"max\": 24\n            }\n          ],\n          \"else\": [\n            {\n              \"push\": {\n                \"shots\": {\n                  \"thumb\": \"$img\",\n                  \"url\": \"$saved.url\",\n                  \"kind\": \"$saved.kind\"\n                }\n              },\n              \"max\": 24\n            }\n          ]\n        },\n        {\n          \"if\": \"$settings.to_devices\",\n          \"then\": [\n            {\n              \"send\": {\n                \"shots\": {\n                  \"text\": \"$text\",\n                  \"link\": \"$saved.url\",\n                  \"at\": \"$now\"\n                }\n              },\n              \"file\": \"$img\",\n              \"alert\": \"New screenshot\"\n            }\n          ]\n        }\n      ]\n    },\n    \"got_shot\": {\n      \"steps\": [\n        {\n          \"set\": {\n            \"lastText\": \"$args.event.text\",\n            \"lastLink\": \"$args.event.link\"\n          }\n        },\n        {\n          \"if\": \"$args.file\",\n          \"then\": [\n            {\n              \"push\": {\n                \"shots\": {\n                  \"thumb\": \"$args.file\",\n                  \"url\": \"$args.event.link\",\n                  \"kind\": \"received\"\n                }\n              },\n              \"max\": 24\n            }\n          ]\n        }\n      ]\n    },\n    \"copy_text\": {\n      \"steps\": [\n        {\n          \"clipboard.write\": {\n            \"text\": \"$lastText\"\n          }\n        }\n      ]\n    },\n    \"copy_link\": {\n      \"steps\": [\n        {\n          \"clipboard.write\": {\n            \"text\": \"$lastLink\"\n          }\n        }\n      ]\n    },\n    \"copy_shot\": {\n      \"steps\": [\n        {\n          \"if\": \"$args.item.kind | map:{s3:true, else:false}\",\n          \"then\": [\n            {\n              \"clipboard.write\": {\n                \"text\": \"$args.item.url\"\n              }\n            }\n          ],\n          \"else\": [\n            {\n              \"clipboard.write\": {\n                \"image\": \"$args.item.thumb\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  },\n  \"views\": {\n    \"menubar\": {\n      \"icon\": \"camera.viewfinder\",\n      \"label\": \"{$shots | count} shots\",\n      \"card\": \"main\"\n    },\n    \"floating\": {\n      \"card\": \"main\",\n      \"pin\": true\n    },\n    \"phone\": {\n      \"card\": \"phone\"\n    }\n  },\n  \"shortcuts\": {\n    \"actions\": {\n      \"grab\": {\n        \"keys\": \"ctrl+shift+2\",\n        \"scope\": \"global\"\n      }\n    }\n  }\n}\n",
    "files": []
}