Skip to content

fix(widget): revert category grouping to top-level - #233

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/revert-widget-category-grouping
Aug 23, 2026
Merged

fix(widget): revert category grouping to top-level#233
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/revert-widget-category-grouping

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Reverts the category-grouping change from #231, which regressed the homescreen widget in two ways reported in #142.

Problem

#231 (merged 2026-08-20) changed parseCategories() to group by the full category path ("Work > Programming") to match the Activity view. Two regressions resulted:

  1. Full path is wrong for a widget — a widget should show top-level "Work" with all subcategories summed, not "Work > Programming" rows.
  2. Inflated uncategorized — with full-path grouping, ["Uncategorized", "Browser"] and ["Uncategorized", "Games"] became separate rows instead of collapsing into one "Uncategorized" bucket.

Fix

Revert parseCategories() to group by $category[0] only, so every "Uncategorized > *" subcategory rolls back into a single "Uncategorized" row.

Tests

Updates CategoryTimeWidgetUpdaterTest to assert the top-level rollup and adds a regression test (parseCategories_collapsesUncategorizedSubcategories) for the inflated-uncategorized fix.

Verified locally: ./gradlew :mobile:testDebugUnitTest --tests 'net.activitywatch.android.widget.*' — 7/7 pass.

Not in this PR

The original per-category discrepancy that motivated #231 needs separate investigation — the full-path change was the wrong fix for it.

Closes #142

parseCategories() in the homescreen widget grouped by the full category path
("Work > Programming") since ActivityWatch#231, which regressed the widget in two ways
reported in ActivityWatch#142:

1. Full path is wrong for a widget — it should show top-level "Work" with all
   subcategories summed, not "Work > Programming" rows.
2. Inflated uncategorized — ["Uncategorized", "Browser"] and
   ["Uncategorized", "Games"] became separate rows instead of collapsing
   into one "Uncategorized" bucket.

Revert to grouping by $category[0] only, so every "Uncategorized > *"
subcategory rolls back into a single "Uncategorized" row. Keeps
parseCategories() internal for the unit tests and updates them to assert the
top-level rollup, adding a regression test for the uncategorized collapse.

The original per-category discrepancy that motivated ActivityWatch#231 needs separate
investigation — the full-path change was the wrong fix for it.

Closes ActivityWatch#142
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

Reverts widget category grouping from full paths to top-level categories, restoring the compact rollup behavior and consolidating uncategorized subcategories.

  • Aggregates category durations using $category[0].
  • Updates widget parser tests for top-level rollups.
  • Adds regression coverage for collapsing Uncategorized subcategories.

Confidence Score: 5/5

The PR appears safe to merge, with the restored top-level aggregation remaining consistent across the widget’s downstream consumers.

The changed parser preserves total duration while merging rows by top-level category, and the widget’s sorting, chart, colors, and displayed totals all consume that aggregated list consistently.

Important Files Changed

Filename Overview
mobile/src/main/java/net/activitywatch/android/widget/CategoryTimeWidgetUpdater.kt Restores top-level category aggregation; downstream totals, sorting, chart proportions, and row rendering remain consistent with the merged data.
mobile/src/test/java/net/activitywatch/android/widget/CategoryTimeWidgetUpdaterTest.kt Updates expectations for top-level rollups and adds focused regression coverage for uncategorized subcategory consolidation.

Reviews (1): Last reviewed commit: "fix(widget): revert category grouping to..." | Re-trigger Greptile

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click.

This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted.

@ErikBjare
ErikBjare merged commit 8c50bc8 into ActivityWatch:master Aug 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] widget on homescreen

2 participants