Skip to content

fix: treat empty always_active_pattern as unset - #44

Merged
0xbrayo merged 1 commit into
masterfrom
fix/empty-always-active-pattern
Oct 7, 2026
Merged

0xbrayo merged 1 commit into
masterfrom
fix/empty-always-active-pattern

Conversation

@0xbrayo

@0xbrayo 0xbrayo commented Oct 7, 2026

Copy link
Copy Markdown
Member

Problem

When the always_active_pattern setting is an empty string, aw-notify passed it to the query as a regex. An empty regex matches every window event, so period_union added all window time to the not-afk periods. On macOS, time on the lock screen (loginwindow) was then counted as active and reported as Uncategorized, many hours more than aw-webui shows for the same day.

aw-webui only applies the pattern when it is non-empty, so it skips an empty one.

Fix

  • Add get_always_active_pattern, which treats an empty or whitespace-only pattern as unset, matching aw-webui.
  • Use it for both setting lookups (the daily category summary and the activity check).
  • Add a unit test.

Verification

Tested against a live server whose always_active_pattern is "", using one day of data:

Active Uncategorized
Before 14.7h 11.0h (10.6h loginwindow)
After 3h 27m 20m 38s
aw-webui 3h 27m 20m 38s

After the fix, every category total matches aw-webui to within a second or two of rounding.

build_desktop_canonical_events in aw-client-rust does the same thing when given Some(""), so it should probably get the same guard upstream.

An empty `always_active_pattern` setting was passed through to the query
as a regex, and an empty regex matches every window event. All window
time was therefore unioned into the not-afk periods, so time spent on the
macOS lock screen (`loginwindow`) was counted as active and showed up as
Uncategorized, inflating it by hours compared to aw-webui.

Match aw-webui by ignoring an empty or blank pattern, and share the
setting lookup between the daily summary and the activity check.
@0xbrayo
0xbrayo merged commit 6694ffd into master Oct 7, 2026
5 checks passed
@0xbrayo
0xbrayo deleted the fix/empty-always-active-pattern branch October 8, 2026 11:06
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.

1 participant