chopstick
All widgets

New Event

Comes with Chopstick

Type an event in search, like "meet john at 5pm" or "lunch with sara tomorrow at 1", to see it; Return adds it to your calendar.

Already installed? It's in your widget library.

Type it in the notch's search

  • New event title when

What it runs

A widget is a folder of plain files. Here is all of its code.

widget.json
{
  "id": "new-event",
  "name": "New Event",
  "icon": "icon.png",
  "description": "Type an event in search, like \"meet john at 5pm\" or \"lunch with sara tomorrow at 1\", to see it; Return adds it to your calendar.",
  "anytime": false,
  "initial": "help",
  "commands": {
    "add": {
      "description": "Add an event to the default calendar.",
      "phrase": "New event {title} {when}",
      "inputs": {
        "title": { "type": "string", "description": "What the event is" },
        "when": { "type": "date", "description": "When: 5pm, tomorrow at 1, friday 3-4pm (an hour unless an end is given)" }
      },
      "preview": { "state": "draft" },
      "do": [ { "add_event": "{{input.title}}", "start": "{{input.when.start}}", "end": "{{input.when.end}}", "then": "added", "else": "draft" } ]
    }
  },
  "states": {
    "help": {
      "task": true,
      "open": true,
      "compact": { "leading": { "symbol": "calendar.badge.plus" } },
      "expanded": {
        "size": "compact",
        "header": { "symbol": "calendar.badge.plus", "title": "New Event" },
        "blocks": [
          { "note": "Type an event in search (⌘Space): meet john at 5pm, lunch with sara tomorrow at 1, dentist friday 3-4pm." }
        ]
      }
    },
    "draft": {
      "task": true,
      "open": true,
      "compact": { "leading": { "symbol": "calendar.badge.plus" }, "trailing": { "text": "{{input.title}}" } },
      "expanded": {
        "size": "compact",
        "header": { "symbol": "calendar.badge.plus", "title": "New Event" },
        "blocks": [
          { "stack": [ { "text": "{{input.title}}", "style": "title" }, { "text": "{{input.when.text}}", "style": "caption" } ] },
          { "note": "{{error}}" },
          { "button": { "symbol": "calendar.badge.plus", "label": "Add to Calendar", "style": "filled",
                        "do": [ { "add_event": "{{input.title}}", "start": "{{input.when.start}}", "end": "{{input.when.end}}", "then": "added" } ] } }
        ]
      },
      "keys": [ { "key": "esc", "do": [ "dismiss" ] } ]
    },
    "added": {
      "task": true,
      "dismiss_after": 2,
      "compact": { "leading": { "symbol": "calendar.badge.checkmark", "tint": "green" }, "trailing": { "text": "Added" } }
    }
  }
}