Implement Gmail activity tracking with optional metadata extraction#218
Implement Gmail activity tracking with optional metadata extraction#218RaoufGhrissi wants to merge 1 commit intoActivityWatch:masterfrom
Conversation
b06c12e to
2c15ffd
Compare
|
Hi! I might be wrong, but it seems to me that aw-watcher-web is meant to stay pretty focused on web watching. Because of that, I’d probably suggest implementing this as a separate extension instead :) |
2c15ffd to
d3f63b9
Compare
Greptile SummaryThis PR implements Gmail activity tracking as an opt-in feature within the ActivityWatch web extension. When enabled via a new settings toggle, a content script injected into Key changes:
Main concerns:
Confidence Score: 2/5Not ready to merge — the 1-second polling interval and one-time settings check are production-quality blockers The core architecture (content script → background message → AW heartbeat, with normal heartbeat suppressed for Gmail) is sound, but the 1-second interval will flood ActivityWatch with events at 60× normal frequency, and the setting toggle won't take effect dynamically. The fragile internal Gmail DOM selectors are an inherent risk that should at least be documented. The
Important Files Changed
Sequence DiagramsequenceDiagram
participant GM as Gmail Tab (content/gmail.ts)
participant BG as Background Script
participant AW as ActivityWatch Server
Note over GM: Content script loads on mail.google.com
GM->>GM: browser.storage.local.get('gmailEnabled')
alt gmailEnabled === true
GM->>GM: setInterval(sendGmailHeartbeat, 1000ms)
end
loop Every 1 second
GM->>GM: Extract activity state + metadata
GM->>BG: runtime.sendMessage({type: AW_GMAIL_HEARTBEAT, data})
BG->>BG: getEnabled() && getGmailEnabled()
alt Both enabled
BG->>AW: sendHeartbeat(bucketId, data, pulsetime=10s)
else Disabled
BG-->>GM: (message silently dropped)
end
end
Note over BG: Alarm fires every ~30s
BG->>BG: heartbeat(): check gmailEnabled
alt gmailEnabled && url includes mail.google.com
BG-->>BG: return (skip — Gmail content script handles it)
else Normal tab or Gmail disabled
BG->>AW: sendHeartbeat(bucketId, normalData)
end
Reviews (1): Last reviewed commit: "Implement Gmail activity tracking with o..." | Re-trigger Greptile |
Hi @BelKed thanks, |
ad12e9b to
2522a8a
Compare
ActivityWatch is used in timesheet tracking, and knowing just "reading" or "composing" email info is not very useful on its own. Extracting involved email metadata (Sender, Recipients, Subject) helps determine the context of the activity relative to project models and workflows in the used software. A new setting has been added to allow users to enable or disable Gmail tracking. Also added a build.sh script to simplify the build and test process for Chrome and Firefox. ui related changes: ActivityWatch/aw-webui#796
2522a8a to
5a79cb0
Compare
ActivityWatch is used in timesheet tracking, and knowing just "reading" or "composing" email info is not very useful on its own. Extracting involved email metadata (Sender, Recipients, Subject) helps determine the context of the activity relative to project models and workflows in the used software.
A new setting has been added to allow users to enable or disable Gmail tracking.
Also added a build.sh script to simplify the build and test process for Chrome and Firefox.