Export ActivityWatch data to TimeWarrior with rule-based tag categorization
Project description
Better Categorizer and Timewarrior Companion
Problem: ActivityWatch collects great data, but it's hard to get useful insights from it.
Solution: Rule-based categorization that transforms raw ActivityWatch events into meaningful tags with multiple output options.
Currently this script exports data from ActivityWatch into TimeWarrior, but I'm planning to let this be a general categorization/tagging tool with possibility to store things in different backends, possibly including to work as a watcher and reexport data back into ActivityWatch.
What it does
- Categorizes ActivityWatch events using configurable rules (browser URLs, editor files, app names, tmux sessions)
- Exports categorized activity to TimeWarrior for time tracking
- Report and analyze commands to aid the user into tweaking the rules and configuration and reexporting the data.
Installation
pip install aw-export-timewarrior
Requirements
- Modern python - 3.13+ according to the
pyproject.toml, but it may probably work on elder versions as well. - ActivityWatch with aw-watcher-window running
- TimeWarrior installed
Optional Watchers
For richer tag extraction, install additional watchers:
- aw-watcher-web - Extract tags from browser URLs
- aw-watcher-vim - Extract tags from Vim file paths
- activity-watch-mode - Extract tags from Emacs file paths
- aw-watcher-tmux - Extract tags from tmux sessions
- aw-watcher-ask-away - Prompt for activity description after AFK periods
- aw-watcher-afk-lid - Track AFK based on laptop lid state
Support for other watchers may be considered, reach out by email or add an issue or pull request for it.
Quick Start
# Continuous sync mode
aw-export-timewarrior sync
# Compare ActivityWatch data with TimeWarrior (dry-run)
aw-export-timewarrior diff --day yesterday
# Apply suggested changes
aw-export-timewarrior diff --day yesterday --apply
# Gain insight into events and rules
aw-export-timewarrior report --from '2 hours ago' --show-rule
aw-export-timewarrior analyze --day yesterday --limit 30
Configuration
Configuration is stored in ~/.config/activitywatch/aw-export-timewarrior/aw-export-timewarrior.toml.
Rule Types
- Browser rules (
rules.browser.*): Match URLs withurl_regexp - Editor rules (
rules.editor.*): Match byprojectname orpath_regexp - App rules (
rules.app.*): Match byapp_namesandtitle_regexp - Tmux rules (
rules.tmux.*): Match bysession,window,command,path - Tag rules (
tags.*): Transform tags withadd,remove,replaceoperations - Exclusive rules (
exclusive.*): Prevent conflicting tags from combining
Example Configuration
[rules.browser.github]
url_regexp = "github\\.com"
tags = ["coding", "github"]
[rules.editor.myproject]
path_regexp = "/home/user/projects/myproject"
tags = ["myproject", "coding"]
[rules.app.slack]
app_names = ["slack", "Slack"]
tags = ["communication", "slack"]
[tags.coding-is-work]
source_tags = ["coding"]
add = ["4WORK"]
[exclusive.afk]
tags = ["afk", "not-afk"]
Commands
| Command | Description |
|---|---|
sync |
Continuous sync from ActivityWatch to TimeWarrior |
diff |
Compare and generate correction commands |
report |
Show activity report with tags |
analyze |
Analyze events without exporting |
timeline |
Show side-by-side ActivityWatch vs TimeWarrior |
validate |
Validate configuration file |
Use --help with any command for detailed options.
Documentation
- Tracking Algorithm - How events are processed and exported
- Testing Guide - Running and writing tests
- TODO / Changelog - Completed features and planned work
Background
This tool bridges ActivityWatch (automatic activity tracking) and TimeWarrior (manual time tracking). See the blog posts for rationale:
- General thoughts on time tracking
- Comparison of different software
- Early experiences on combinging AW and TW
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aw_export_timewarrior-0.0.0.tar.gz.
File metadata
- Download URL: aw_export_timewarrior-0.0.0.tar.gz
- Upload date:
- Size: 87.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa06ebdb3694b53954363df69859d6de6e094d60b757f355521161a1602db814
|
|
| MD5 |
61cdb1d42189977913a31faf2b090ecc
|
|
| BLAKE2b-256 |
c8da3696fb52a9d324b704440a6f99aeaa34bf698d37c20780c465870ae26b5f
|
Provenance
The following attestation bundles were made for aw_export_timewarrior-0.0.0.tar.gz:
Publisher:
publish.yml on tobixen/aw-export-timewarrior
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aw_export_timewarrior-0.0.0.tar.gz -
Subject digest:
aa06ebdb3694b53954363df69859d6de6e094d60b757f355521161a1602db814 - Sigstore transparency entry: 813458813
- Sigstore integration time:
-
Permalink:
tobixen/aw-export-timewarrior@fc5a849995580c47e54bd212b6e5dae2d564aff6 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/tobixen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc5a849995580c47e54bd212b6e5dae2d564aff6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aw_export_timewarrior-0.0.0-py3-none-any.whl.
File metadata
- Download URL: aw_export_timewarrior-0.0.0-py3-none-any.whl
- Upload date:
- Size: 94.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
befc9b5376f473d0d16b204b1fad315972fd7528a943e237388b4ea34e60cb24
|
|
| MD5 |
4fd62b517b72c5eaa411e6bee7af2819
|
|
| BLAKE2b-256 |
6789738931cc6069a14301d57b5bf0413c6d65a7ad38304b8c358ed82dcc266e
|
Provenance
The following attestation bundles were made for aw_export_timewarrior-0.0.0-py3-none-any.whl:
Publisher:
publish.yml on tobixen/aw-export-timewarrior
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aw_export_timewarrior-0.0.0-py3-none-any.whl -
Subject digest:
befc9b5376f473d0d16b204b1fad315972fd7528a943e237388b4ea34e60cb24 - Sigstore transparency entry: 813458814
- Sigstore integration time:
-
Permalink:
tobixen/aw-export-timewarrior@fc5a849995580c47e54bd212b6e5dae2d564aff6 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/tobixen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc5a849995580c47e54bd212b6e5dae2d564aff6 -
Trigger Event:
push
-
Statement type: