Repository navigation
fix: treat empty always_active_pattern as unset - #44
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the
always_active_patternsetting is an empty string, aw-notify passed it to the query as a regex. An empty regex matches every window event, soperiod_unionadded 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
get_always_active_pattern, which treats an empty or whitespace-only pattern as unset, matching aw-webui.Verification
Tested against a live server whose
always_active_patternis"", using one day of data:loginwindow)After the fix, every category total matches aw-webui to within a second or two of rounding.
build_desktop_canonical_eventsin aw-client-rust does the same thing when givenSome(""), so it should probably get the same guard upstream.