Taskwarrior for Google Calendar Sync
See also the privacy policy for this app: https://bergercookie.dev/tw-gcal-sync-privacy-policy
Description
Given all the entries of a Calendar in Google Calendar with all the tasks of a Taskwarrior filter (combination of tags and projects) synchronise all the addition/modification/deletion events between them.
Demo - first run - populating calendar in GCal
Motivation
While Taskwarrior is an excellent tool when it comes to keeping TODO lists, keeping track of project goals etc., lacks the portability, simplicity and minimalistic design of Google Calendar. The latter also has the following advantages:
- Automatic sync across all your devices
- Comfortable addition/modification of events using voice commands
- Actual reminding of events with a variety of mechanisms
Override Calendar API key
Unfortunately I have not yet verified this app with Google so new users are currently blocked from using it. To bypass that you can register for your own developer account with the Google Calendar API with the following steps:
Firstly, remove the ~/.gcal_credentials.pickle
file on your system since that
will be reused if found by the app.
For creating your own Google Developer App:
- Go to the Google developer console
- Make a new project
- From the sidebar go to
API & Services
and once there click theENABLE APIS AND SERVICES
button - Look for and Enable the
Calendar API
Your newly created app now has access to the Calendar API. We now have to create and download the credentials:
Again, from the sidebar under
API And Services
clickCredentials
Enable the
Calendar API
On the sidebar click
Credentials
, and once there clickCREATE CREDENTIALS
Create a new
OAuth Client ID
. Set the type toDesktop App
(app name is not important).Finally download the credentials in JSON form by clicking the download button as shown below. This is the file you need to point to when running
tw_gcal_sync
.
To specify your custom credentials JSON file use the --google-secret
flag as follows:
tw_gcal_sync -c "<calendar-name>" -t "<taskwarrior-tag>" --google-secret "<path/to/downloaded/json/file>"
Usage Examples
Run the tw_gcal_sync
to synchronise the Google calendar of your choice with
the selected Taskwarrior tag(s). Run with --help
for the list of options.
# Sync the +remindme Taskwarrior tag with the calendar named "TW Reminders"
tw_gcal_sync --help
tw_gcal_sync -t remindme -c "TW Reminders"
Installation
Package Installation
Install the syncall
package from PyPI, enabling the google
and tw
extras:
pip3 install syncall[google,tw]
FAQ
How do I mark an item as done from Google Calendar
If the item was created from Taskwarrior then there should be a
status: pending
line in its description. Change it to status: done
or
status: completed
.
How do i modify the default event duration / How do I change the duration of a said event from Taskwarrior
syncall
is aware of the syncallduration
Taskwarrior
UDA
. This means you can assign a custom
duration to a Taskwarrior task using something like the following:
# create a task ...
# Make this a 15min task
task <id> mod syncallduration:15M
Then on subsequent runs, it will create an event of the said duration in Google Calendar.
You can also edit the default event duration using the
--default-event-duration-mins INTEGER
flag (specify it in minutes)
Note: To make it viewing the duration a bit more user friendly, e.g., for
Taskwarrior reports, the user can also add the following section to their
.taskrc
:
uda.syncallduration.type=duration
uda.syncallduration.label=GCal duration
See also
- Taskwarrior Filtering.md.