Files
calcurse-gcal/README.md
T

77 lines
3.1 KiB
Markdown

# calcurse-gcal
Keeps [calcurse](https://calcurse.org) in sync with Google Calendar through `calcurse-caldav`, and handles what
`calcurse-caldav` leaves to you:
- `calcurse-sync`: hourly sync from a systemd user timer. It skips the sync while the calcurse UI is open (the UI keeps
the data in memory and would overwrite what was synced), and restarts the calcurse daemon after an import so new
appointments get alerts.
- UI hooks: sync before the UI loads, and again after it exits when it saved changes.
- `calcurse-relogin`: when Google's login expires, a notification asks to log in again; clicking it opens the consent
page and catches the redirect on `127.0.0.1`, so there is no code to copy and paste.
- `calcurse-today`: a morning notification for today's whole-day events (the daemon only alerts timed appointments).
- `calcurse-xmobar`: the next appointment for xmobar, and today's and tomorrow's items in a notification.
## Requirements
- A Google Cloud OAuth client (type "Desktop app") with the Calendar API enabled, and its client ID and secret.
- A notification daemon (`notify-send`, with actions support for the login prompt).
## Installation
Build and install the package with the included PKGBUILD, which builds the signed release tag set in `pkgver`:
```
makepkg -si
```
Or, with aurutils, build it into a local repository with `aur build` and install it with pacman.
Then:
1. Copy `/usr/share/doc/calcurse-gcal/config.example` to `~/.config/calcurse/caldav/config` (mode 600) and fill in
your address and OAuth client.
2. Log in once: `calcurse-relogin`, then click Allow in the browser.
3. Link the hooks (if you have your own, call these from them instead):
```
mkdir -p ~/.config/calcurse/hooks
ln -s /usr/share/calcurse-gcal/hooks/{pre-load,post-save} ~/.config/calcurse/hooks/
```
4. Start the timers from your window manager's startup, along with the daemon (the units have no `[Install]`, so
they don't run under other sessions):
```
calcurse --daemon
systemctl --user start calcurse-sync.timer calcurse-today.timer
```
5. Optional, for desktop notifications of appointments, in `~/.config/calcurse/conf`:
```
notification.command=calcurse --next | xargs -0 notify-send -a calcurse -i x-office-calendar "Appointment"
```
### xmobar
```haskell
, Run Com "calcurse-xmobar" [] "calcurse" 600
```
and `<action=`calcurse-xmobar list`>%calcurse%</action>` in the template. `--apt-color`, `--event-color`, `--icon`
and `--suffix` change the defaults (Dracula pink and cyan, a Nerd Font calendar icon, `" | "`).
## Login expiry
With the OAuth client's consent screen in "Testing" status, Google documents a 7-day login expiry. Publishing it
("In production") makes the login last until revoked or unused for 6 months. Publishing needs no verification for
personal use (the login shows an "unverified app" warning once), but the Branding page needs an app home page and a
privacy policy URL on an authorized domain, besides the starred fields. After publishing, log in again: logins
issued while in Testing may keep the limit.
```
mv ~/.config/calcurse/caldav/oauth2_cred ~/.config/calcurse/caldav/oauth2_cred.bak
calcurse-relogin
```