From 8d22b2c1ecdc9994d2cc5168018fcdafabb3b8c9 Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 25 Nov 2026 18:54:24 +0000 Subject: [PATCH 1/2] docs(directories): document aw-server-rust --dbpath and its aw-qt caveat The page names the data directories but never says the database can live elsewhere, which is the first question from users keeping their data on an external drive. Document the CLI flag, that it is not a config/UI setting, that aw-qt cannot pass it (so autostart_modules needs editing), the single-writer caveat, and that aw-server (Python) has no equivalent. Git-Session-Id: 5458086f-339f-47ce-8bdd-5ff30f715ac0 --- src/directories.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/directories.rst b/src/directories.rst index 069aa3e..73f668f 100644 --- a/src/directories.rst +++ b/src/directories.rst @@ -31,6 +31,36 @@ This is where the SQLite database and other persistent data is stored. - macOS: ``~/Library/Application Support/activitywatch/aw-server-rust`` - Linux: ``~/.local/share/activitywatch/aw-server-rust`` +.. _relocating-the-database: + +Changing the database location +------------------------------ + +``aw-server-rust`` accepts ``--dbpath `` to keep its SQLite database +somewhere else, for example on an external drive shared between machines:: + + aw-server-rust --dbpath "E:\ActivityWatchData" + +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. To run ``aw-server-rust`` with ``--dbpath``, start it yourself (a +``.bat`` file or shortcut works well) and stop ``aw-qt`` from starting its own +copy, otherwise two servers compete for port 5600. Remove ``aw-server-rust`` +from ``autostart_modules`` in ``aw-qt.toml`` (in the ``aw-qt`` config +directory); the tray's **Modules** menu only stops it for the current session. + +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. To combine separate per-machine databases, use + :doc:`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 + ``--profile`` to isolate a named instance under the default data directory. + .. _config-directory: Config From 5a8d7129d3fd87953de00820cf2dd297b90a458f Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 25 Nov 2026 19:19:19 +0000 Subject: [PATCH 2/2] docs(directories): fix --dbpath usage and cover existing history --dbpath takes the database file, not a directory: with the released v0.14.3 binary a directory path (or a missing parent folder) makes the datastore worker panic. The classic app starts the Python aw-server by default, so remove whichever server is listed in autostart_modules, and explain how to bring existing history to the new location. Git-Session-Id: 3b28c971-364c-567b-afa9-b80e3d39b9bd --- src/directories.rst | 57 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/directories.rst b/src/directories.rst index 73f668f..fd31179 100644 --- a/src/directories.rst +++ b/src/directories.rst @@ -36,31 +36,68 @@ This is where the SQLite database and other persistent data is stored. Changing the database location ------------------------------ -``aw-server-rust`` accepts ``--dbpath `` to keep its SQLite database -somewhere else, for example on an external drive shared between machines:: +``aw-server-rust`` accepts ``--dbpath `` to keep its SQLite database +somewhere else, for example on an external drive that you move between +machines:: - aw-server-rust --dbpath "E:\ActivityWatchData" + 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. To run ``aw-server-rust`` with ``--dbpath``, start it yourself (a -``.bat`` file or shortcut works well) and stop ``aw-qt`` from starting its own -copy, otherwise two servers compete for port 5600. Remove ``aw-server-rust`` -from ``autostart_modules`` in ``aw-qt.toml`` (in the ``aw-qt`` config -directory); the tray's **Modules** menu only stops it for the current session. +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: + +1. Quit ActivityWatch. +2. Stop ``aw-qt`` from starting a server of its own, otherwise two servers + compete for port 5600. In ``aw-qt.toml`` (in the ``aw-qt`` + :ref:`config directory `), remove whichever server is listed + in ``autostart_modules``: ``aw-server``, or ``aw-server-rust`` if you have + :doc:`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. +3. Create the destination folder and bring along any existing history (see + below). +4. Start ``aw-server-rust`` with ``--dbpath`` yourself (a ``.bat`` file 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. To combine separate per-machine databases, use - :doc:`syncing` instead. + 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 :doc:`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 ``--profile`` to 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, copy + ``sqlite.db`` from its :ref:`data directory ` to the new + folder, along with ``sqlite.db-wal`` and ``sqlite.db-shm`` if they exist. +- If your history is in ``aw-server`` (Python): add ``--import-legacy`` + (``v0.14.1`` or 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-directory: Config