Skip to content

Commit 22c8e94

Browse files
committed
📝 Update docs
1 parent 73cdfb9 commit 22c8e94

File tree

6 files changed

+116
-16
lines changed

6 files changed

+116
-16
lines changed

Docs/Dates.md Development/Dates.md

File renamed without changes.
File renamed without changes.

Docs/Config.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
**Example**
44

5+
This config will
6+
- add a "🪷" icon to every calendar item matching the `Yoga` regex
7+
- fire an `calendar_changed` event for sketchybar if events change
58
```
69
{
710
"iconize": [
811
{
912
"field": "title.label",
10-
"regex": "Movement Yoga",
13+
"regex": "Yoga",
1114
"icon": "🪷"
1215
}
1316
],

Docs/Services.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ At the moment these service are supported
77
- `ical`. Custom URL scheme to open events in the `Calendar.app`
88
- `meet`. [Google Meet](https://meet.google.com)
99
- `zoom`. [Zoom](https://www.zoom.com/)
10-
10+
- `teams` [Microsoft Teams](https://www.microsoft.com/en-us/microsoft-teams/group-chat-software)

Docs/Sketchybar.md

+92-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,100 @@
22

33
You can use `plan` to show the next calendar event with [Sketchybar](https://felixkratz.github.io/SketchyBar/)
44

5+
## Lua
6+
7+
Put this file in `./items/Calendar`
8+
9+
```lua
10+
local sbar = require("sketchybar")
11+
12+
local Calendar = {}
13+
function Calendar.new()
14+
local self = {}
15+
16+
local icons = {
17+
default: ""
18+
}
19+
20+
self.add = function(position)
21+
local calendar = sbar.add("item", {
22+
position = position,
23+
update_freq = 120,
24+
icon = icons.default,
25+
})
26+
27+
local update = function()
28+
sbar.exec("/opt/homebrew/bin/plan next --ignore-tags timeblock --ignore-all-day-events", function(json)
29+
local event = json[1]
30+
if event ~= nil then
31+
local icon = strings.TrimToNil(event.title.icon) or icons.default
32+
local label = event.title.label
33+
local suffix = ""
34+
35+
if event["schedule"]["start"]["in"] < 0 then
36+
suffix = ", " .. event["schedule"]["end"]["in"] .. "m" .. " left"
37+
else
38+
suffix = " in " .. event["schedule"]["start"]["in"] .. "m"
39+
end
40+
calendar:set({
41+
icon = {
42+
string = icon,
43+
drawing = true,
44+
},
45+
label = {
46+
string = label .. suffix,
47+
drawing = true,
48+
},
49+
drawing = true,
50+
})
51+
52+
local url = ""
53+
for type, u in pairs(event["services"]) do
54+
if type == "ical" then
55+
url = u
56+
end
57+
end
58+
calendar:subscribe("mouse.clicked", function(_)
59+
sbar.exec("open '" .. url .. "'")
60+
end)
61+
else
62+
calendar:set({
63+
icon = {
64+
string = icons.default,
65+
drawing = true,
66+
},
67+
label = {
68+
drawing = false,
69+
},
70+
drawing = true,
71+
})
72+
end
73+
end)
74+
end
75+
76+
calendar:subscribe({ "forced", "routine", "system_woke" }, function(_)
77+
focus.handler(update)
78+
end)
79+
end
80+
81+
return self
82+
end
83+
84+
return Calendar
85+
86+
```
87+
88+
Include it from `sketchybarrc`
89+
90+
```
91+
require("items.calendar").new().add("right")
92+
```
93+
594
# Advanced
695

7-
You can use `plan watch` feature to notify Sketchybar of any changes.to
96+
> [!warn] This feature is currently under review. It works when run in a terminal but not when run as a service.
97+
98+
You can use `plan watch` feature to notify Sketchybar of any changes.
899

9100
You need to configure a hook in your `~/.config/plan/config.json`. For example:
10101

README.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ A macOS terminal tool to fetch calendar events from `Calendar.app`
44

55
## Features
66

7-
- return JSON by default
8-
- for emoji lovers: separate leading emojis from event title, giving you the emoji, short and full title
9-
- ignore events based on tags e.g. `tag:example` within the event notes
10-
- return start and end time in relative and absolute terms
11-
- return an `ical` URL that can be used to `open $URL` to show the particular event in Calendar.app
12-
- parse Google meet URLs from notes
13-
- print out calendar entries with a templating engine
7+
- JSON by default
8+
- templating engine for
9+
- for emoji lovers ❤️
10+
- separate leading emojis from event title
11+
- add emojis based on title
12+
- start and end time in relative and absolute terms
13+
- `ical` URL that can be used to show the event in Calendar.app
14+
- parse meeting URLs from notes (Google, Zoom, Teams)
15+
- natural language parser for date selection
1416

1517
## Examples
1618

@@ -29,7 +31,7 @@ Example output in JSON
2931
"color": "#E195DA",
3032
"label": "Some calendar",
3133
"type": "caldav",
32-
"source": ""
34+
"source": "Personal"
3335
},
3436
"title": {
3537
"full": "🏆 Release plan",
@@ -44,13 +46,15 @@ Example output in JSON
4446
"end": {
4547
"at": "2024-09-02T19:00:00+02:00",
4648
"in": 90
47-
}
49+
},
50+
"all_day": false,
51+
"duration": 60
4852
},
4953
"services": [
5054
{ "ical": "ical://ekevent/9675DF46-4040-4762-A70B-6CD65DC01C36?method=show&options=more" }
5155
],
5256
"tags": [ "timeblock" ]
53-
}
57+
}
5458
]
5559
```
5660

@@ -72,7 +76,7 @@ You get
7276
- 13:00 - 14:00 🕐 Meeting [ ](ical://ekevent/59856934-5D89-45A2-9C11-0E3877F1B082?method=show&options=more) #work
7377
```
7478

75-
For more details, consult [Docs/Templating](Docs/Templating.md).
79+
For more details, see [Docs/Templating](Docs/Templating.md).
7680

7781
## Usage
7882

@@ -83,11 +87,13 @@ Example commands (use `plan --help` for full usage)
8387
- `plan calendars` List available calendars
8488
- `plan next` Returns the current or next event within the next hour
8589
- `plan today` Returns all events for today
90+
- `plan on [expression]` Return all events on the given days e.g. `plan on "next monday"`
8691

8792
## Use cases
8893

89-
`plan` can help with your "productivity" setup. It plays very well with Sketchybar and Obsidian.
90-
But with the default output being JSON, and the templating engine, you can easily make `plan` fit your individual needs.
94+
`plan` can help with your productivity setup.
95+
96+
It plays very well with Sketchybar and Obsidian and with the default output format being JSON, and the templating engine, you can easily make `plan` fit your individual needs.
9197

9298
### Sketchybar
9399

0 commit comments

Comments
 (0)