Backup & Restore

Is it enough to backup

~/.local/share/activitywatch
~/.config/activitywatch

in order to be able to restore all settings, especially custom categories, and logged data on a different PC?

Custom categories are currently saved in your browser (a future version will change this, hopefully soon) so you need to inspect your browsers local storage to save this (not very user friendly, sorry). But otherwise yes.

However, the best backup would be to export all the buckets from the ‘Raw Data’ view. That ensures you have the data in an easy-to-import format that will be stable across versions.

1 Like

Manually exporting all buckets as JSON is not applicable in my case, because I use a software that does regular backups of certain folders and files.

If you say that those two folders contain everything, and hopefully soon the categories too, then I’m totally fine with it. But to be on the safe side, ActivityWatch could automatically export all buckets regularly too if your experience shows that this is necessary.

You can easily automatically export the buckets as JSON through the API yourself, here are a couple of bash snippets which only need curl.

All buckets:

curl http://localhost:5600/api/0/export > "activitywatch-export-full-$(date --iso-8601).json"

A specific bucket:

bucketid="aw-watcher-afk_hostname"
curl http://localhost:5600/api/0/buckets/$bucketid/export > "activitywatch-export-$bucketid-$(date --iso-8601).json"

Looks nice, but I don’t know how to implement that.