Directories¶
Where things get stored depends on the platform you’re using. All paths should follow standard directories on their platforms, and to accomplish this we use platformdirs in Python code and the dirs crate in Rust code.
Each ActivityWatch component stores its data in a subdirectory named after itself.
The paths below use aw-server-rust as an example component.
Note
On Windows, Python components (aw-server, aw-qt, aw-watcher-afk, aw-watcher-window, …) use one extra activitywatch level, e.g. C:\Users\<USER>\AppData\Local\activitywatch\activitywatch\aw-server for data and ...\Local\activitywatch\activitywatch\Logs\aw-watcher-window for logs. Rust components (aw-server-rust, aw-sync) use the paths listed below; aw-tauri follows them for its own config and data from the release after v0.14.0 (aw-tauri#280).
Note
v0.14.0 on Windows mistakenly stored aw-server-rust data and config, and aw-sync config, under AppData\Roaming (%APPDATA%) instead of AppData\Local (%LOCALAPPDATA%). The release after v0.14.0 fixes this and migrates automatically on startup:
If
AppData\Local\activitywatch\aw-server-rusthas no database yet, theRoamingfolder is copied there, verified, and the original kept asaw-server-rust.migrated-<date>. Nothing is deleted or overwritten. If a Pythonaw-serverdatabase exists,aw-server-rustalso runs the import of it thatv0.14.0skipped, once.If
AppData\Localalready has a database (you used ActivityWatch beforev0.14.0), it stays in use and theRoamingfolder is left untouched, with a warning in the log. Events recorded while runningv0.14.0are in thatRoamingdatabase and are not merged automatically.If the copy cannot be completed safely, the
Roamingfolder keeps being used and the migration is retried on the next start.
Note
These paths are pinned by tests on every platform: tests/test_dirs_pinned.py in aw-core (Python), test_default_paths_are_pinned in aw-server-rust (and aw-tauri once #280 lands), and test_legacy_dbfile_path_is_pinned in aw-server-rust (where the Python database is looked for when migrating). If you change a path, change this page and those tests together, and add a migration for existing installs.
Data¶
This is where the SQLite database and other persistent data is stored.
Windows:
C:\Users\<USER>\AppData\Local\activitywatch\aw-server-rustmacOS:
~/Library/Application Support/activitywatch/aw-server-rustLinux:
~/.local/share/activitywatch/aw-server-rust
Changing the database location¶
aw-server-rust accepts --dbpath <file> to keep its SQLite database
somewhere else, for example on an external drive that you move between
machines:
aw-server-rust --dbpath "E:\ActivityWatchData\sqlite.db"
The value is the path of the database file, not of a directory, and the folder containing it must already exist. If either is wrong, the server cannot open the database.
The flag is only available on the command line: it is not a setting in the
config file or the web UI, and aw-qt starts the server without extra
arguments. The Tauri app embeds the server and has no equivalent option. Note
also that the classic app starts aw-server (the Python server) by default,
not aw-server-rust. To use --dbpath with the classic app:
Quit ActivityWatch.
Stop
aw-qtfrom starting a server of its own, otherwise two servers compete for port 5600. Inaw-qt.toml(in theaw-qtconfig directory), remove whichever server is listed inautostart_modules:aw-server, oraw-server-rustif you have switched to it. Make sure the lines are uncommented. With the default watchers this gives:[aw-qt] autostart_modules = ["aw-watcher-afk", "aw-watcher-window"]
The tray’s Modules menu is not enough, as it only stops a server for the current session.
Create the destination folder and bring along any existing history (see below).
Start
aw-server-rustwith--dbpathyourself (a.batfile or shortcut works well), then start ActivityWatch.
Notes:
A shared database is not syncing. Only one process may write to it at a time, so do not run ActivityWatch on two machines against the same database simultaneously. Do not put it on a network share either, since SQLite’s write-ahead log does not work over network filesystems. To combine separate per-machine databases, use Syncing instead.
Installing ActivityWatch to a different drive and leaving the default data directory alone keeps the database on the system drive; the data directory is independent of the install location.
aw-server(the Python server) has no--dbpath; it only supports--profileto isolate a named instance under the default data directory.
Moving existing history¶
--dbpath only selects which file to use. It does not move any data, and a
path where no file exists yet starts as an empty database.
If your history is in
aw-server-rust: with the server stopped, copysqlite.dbfrom its data directory to the new folder, along withsqlite.db-walandsqlite.db-shmif they exist.If your history is in
aw-server(Python): add--import-legacy(v0.14.1or later) the first time you start with the new file. It imports buckets and events from the Python database in its default location. Web UI settings such as categories are not imported, so first export your categories under Settings and import them again afterwards.
Config¶
Configuration files for each component.
Windows:
C:\Users\<USER>\AppData\Local\activitywatch\aw-server-rustmacOS:
~/Library/Application Support/activitywatch/aw-server-rustLinux:
~/.config/activitywatch/aw-server-rust, or the path defined by the$XDG_CONFIG_HOMEenvironment variable.
Other components have their own config directories, e.g. aw-watcher-afk, aw-watcher-window.
Logs¶
Windows:
C:\Users\<USER>\AppData\Local\activitywatch\Logs\aw-server-rustmacOS:
~/Library/Logs/activitywatch/aw-server-rustLinux:
~/.cache/activitywatch/log/aw-server-rust
Cache¶
Windows:
C:\Users\<USER>\AppData\Local\activitywatch\Cache\aw-server-rustmacOS:
~/Library/Caches/activitywatch/aw-server-rustLinux:
~/.cache/activitywatch/aw-server-rust
Profiles¶
Starting with v0.14, you can run named profiles. A profile is an isolated ActivityWatch instance with its own data, config, and logs, which can run at the same time as your normal instance. The default profile is the normal install, and testing is the profile used by the --testing flag (which runs on port 5666).
To start a profile, run aw-qt --profile <name>. aw-qt passes the profile on to the modules it starts through the AW_PROFILE environment variable. When starting modules separately, set AW_PROFILE=<name> for each of them; aw-server, aw-server-rust, and aw-sync also accept --profile <name>.
For a profile other than default, every directory above uses activitywatch-<name> in place of activitywatch. For example, the Linux data directory for a profile named research is ~/.local/share/activitywatch-research/aw-server-rust.
Profile names must be lowercase letters, digits, - or _ (starting with a letter or digit), and at most 32 characters.
Note
A named profile uses port 5600 unless configured otherwise, which collides with your default instance. Set a different port in that profile’s server and aw-client config files (see Configuration) before running both at once.