Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AFK Entries don't include time before idle-timeout-seconds #19

Open
arbyste opened this issue May 3, 2024 · 7 comments
Open

AFK Entries don't include time before idle-timeout-seconds #19

arbyste opened this issue May 3, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@arbyste
Copy link

arbyste commented May 3, 2024

In the activitywatch docs, it says that if you are AFK for longer than the value in idle-timeout-seconds, then it is recorded as AFK for the full duration of the time you were AFK (https://docs.activitywatch.net/en/latest/faq.html#how-does-activitywatch-know-when-i-am-afk).

In awatcher however, it only counts AFK time starting after idle-timeout-seconds has elapsed. I'm using the bundled version, so I don't know whether this is a problem with awatcher or with upstream activity watch.

Expected behavior:
If idle-timeout-seconds = 180, and you're AFK for 3.5 minutes, then an AFK entry with length 3.5 minutes should be recorded.

Actual behavior:
If idle-timeout-seconds = 180, and you're AFK for 3.5 minutes, then an AFK entry with length 30 seconds is recorded.

@2e3s
Copy link
Owner

2e3s commented May 8, 2024

Hello, thank you for your report. I think you may be right, I didn't pay attention into this. I'll look into this issue.

@2e3s 2e3s added the bug Something isn't working label May 8, 2024
@2e3s
Copy link
Owner

2e3s commented May 17, 2024

I have looked into the issue, it seems that the bug was present only on Wayland idle handlers (KDE, Sway etc) which work differently from the original watchers. Unified the code which should fix it: https://github.com/2e3s/awatcher/releases/tag/v0.2.6

@arbyste
Copy link
Author

arbyste commented May 22, 2024

Thanks for looking into that, it seems to be working now, however now there's some new slightly strange behavior. It looks like when I'm AFK, it actually creates 2 separate entries. Both entries start at the same time, but one of them ends a few seconds after the other. Is that expected behavior?

@2e3s
Copy link
Owner

2e3s commented May 22, 2024

I'm not sure that the AW API allows to create separate parallel entries for AFK. Could you please show what you mean with a screenshot?

@arbyste
Copy link
Author

arbyste commented May 24, 2024

This is what it looks like on the timeline view. Notice there's a black vertical line towards the end:
image

When I click on the left side of the black line, this comes up:
image

When I click on the right side, this comes up:
image

I couldn't take a screenshot while hovering over the respective areas, but when I hover over them, I get more precise timestamps. Both of them start at 21:31:20, the first ends at 21:34:25, and the second ends at 23:34:45.

And this is what it looks like on the Raw Data page:
image

@2e3s
Copy link
Owner

2e3s commented Jun 12, 2024

I have figured out the reason for this, and I've changed the logic to accommodate the timeout correctly. There is a downside for the most correct working for Wayland-protocol-based handlers: the non-idle time now looks lagging. The reason is that between you're AFK and timeout gets fired, there is a time period when the watcher may report incorrectly that you're not AFK which is wrong. Hence it reports only the last time where you were surely online which is now - timeout.

I will test and look at possible issues.

@2e3s
Copy link
Owner

2e3s commented Jul 7, 2024

Been a while, but I have seemingly fixed related issues and released https://github.com/2e3s/awatcher/releases/tag/v0.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants