A macOS automation that opts you into office lunch on officelunch.app on your team's lunch days.
officelunch.app opens opt-in for each lunch day at 9:00 AM the day before and closes it at 9:00 AM on the day, so lunchbot runs inside that window — either the afternoon before or the morning of.
On the morning of a lunch day, if you're at the office (detected by a paired Bluetooth device like a keyboard or mouse, or by a specific external monitor), it opts in automatically. If not — or if you haven't configured either signal — it pops up a dialog asking if you'd like to opt in anyway. Runs the day before always ask, since being at the office today says nothing about tomorrow. Office hardware never overrides an opt-out you made on the site.
Run the install script — it walks you through everything:
./install.sh
It will:
- Prompt for your officelunch.app API token
- List every currently-connected piece of hardware (Bluetooth devices and external monitors) and ask y/N for each — "yes" marks it as office hardware
- Save your selections to
.env - Read your team's lunch days from officelunch.app and ask when to run: the afternoon before (3:30 PM), the morning of (8:30 AM), or a custom time — after 9:00 AM runs the day before, before 9:00 AM runs the day of
- Install and load a LaunchAgent for that schedule
Monitors are identified by model + serial number, so a same-model monitor at home won't trigger detection. Bluetooth devices are matched by exact name. Re-run install.sh at the office to add or revise signals; items not currently connected are preserved across runs.
To run manually inside the opt-in window:
bash lunchbot.sh
Outside the window it exits; bash lunchbot.sh --anytime opts in for whichever lunch day officelunch.app currently has open.
- Exits unless an opt-in window is open (guards the LaunchAgent's run-at-login), then waits for network connectivity (handles laptop wake-from-sleep)
- Reads currently-connected Bluetooth devices (
system_profiler SPBluetoothDataType) and displays (ioreg), comparing against the lists saved in.env - If the open lunch day is today and any configured signal matches: auto opts in via the officelunch.app API, verifies, and shows a confirmation dialog
- Otherwise: prompts you with a Yes/No dialog naming the day ("today", "tomorrow (Tuesday)")
- Logs everything to
lunchbot.log