Welcome to gcalsync, the ultimate tool for syncing your Google Calendars across multiple accounts! Say goodbye to calendar conflicts and hello to seamless synchronization. 🎉
- 🔄 Sync events from multiple Google Calendars across different accounts
- 🚫 Create "blocker" events in other calendars to prevent double bookings
- 🗄️ Store access tokens and calendar data securely in a local SQLite database
- 🔒 Authenticate with Google using the OAuth2 flow for desktop apps
- 🧹 Easy way to cleanup calendars and remove all blocker events with a single command
- Go 1.16 or higher
- A Google Cloud Platform project with the Google Calendar API enabled
- OAuth2 credentials (client ID and client secret) for the desktop app flow
-
Clone the repository:
git clone https://github.com/bobuk/gcalsync.git
-
Navigate to the project directory:
cd gcalsync
-
Install the dependencies:
go mod download
-
Create a
.gcalsync.toml
file in the project directory with your OAuth2 credentials:client_id = "your-client-id" # Your OAuth2 client ID client_secret = "your-client-secret" # Your OAuth2 client secret disable_reminders = false # Disable reminders for blocker events block_event_visibility = "private" # Visibility of blocker events (private, public, or default)
Don't forget to choose the appropriate OAuth2 consent screen settings and add the necessary scopes for the Google Calendar API, also double check that you are select "Desktop app" as application type.
You can move the file to
~/.config/gcalsync/.gcalsync.toml
to avoid storing sensitive data in the project directory. In this case your database file will be created in~/.config/gcalsync/
as well. -
Build the executable:
go build
-
Run the
gcalsync
command with the desired action:- To add a new calendar:
./gcalsync add
- To sync calendars:
./gcalsync sync
- To desync calendars:
./gcalsync desync
- To list all calendars:
./gcalsync list
- To add a new calendar:
To add a new calendar to sync, run the gcalsync add
command. You will be prompted to enter the account name and calendar ID. The program will guide you through the OAuth2 authentication process and store the access token securely in the local database.
To sync your calendars, run the gcalsync sync
command. The program will retrieve events from the specified calendars within the current and next month time window. It will create "blocker" events in other calendars to prevent double bookings and store the blocker event details in the local database.
To desync your calendars and remove all blocker events, run the gcalsync desync
command. The program will retrieve the blocker event details from the local database and remove the corresponding events from the respective calendars.
To list all calendars that have been added to the local database, run the gcalsync list
command. The program will display the account name and calendar ID for each calendar.
By default blocker events will inherit your default Google Calendar reminder/alert settings (typically – 10 minutes before the event). If you do not want to receive reminders for the blocker events, you can disable them by setting the disable_reminders
field to true
in the .gcalsync.toml
configuration file.
By default blocker events will be created with the visibility set to "private". If you want to change the visibility of blocker events, you can set the block_event_visibility
field to "public" or "default" in the .gcalsync.toml
configuration file.
Contributions are welcome! If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request. Let's make gcalsync even better together! 💪
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code as you see fit. We hope you find it useful! 🌟
- The terrible Go programming language
- The Google Calendar API for making this project almost impossible to implement
- The OAuth2 protocol for very missleading but secure authentication
- The SQLite database for lightweight and efficient storage, the only one that added no pain.