ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.73k stars 533 forks source link

Cannot detect Genshin Impact #873

Closed GitPinkRabbit closed 8 months ago

GitPinkRabbit commented 1 year ago

Describe the bug

Today I played Genshin Impact for around 2 hours and found that it's not detect by ActivityWatch.

The thing is, it can be detected before 2023/03/31 and after that I didn't see it anymore in ActivityWatch.

image

As you can see, ActivityWatch knows that I'm not AFK, but it didn't know what I was doing then.

To Reproduce

Maybe just play it for two minutes and see whether if ActivityWatch detects it.

I'm using CN version's launcher though, so it may not reproduce on global version's launcher.

Update: A friend of mine told me it's related to the new version v0.12.2, he is using v0.12.1 and it works fine. Also I updated to the new version at 2023/04/01, which matches the evidence. I don't know which part of logs may help.

The main process name for the CN version is YuanShen.exe.

Expected behavior

It detects it, just as if should.

image

The image comes from 2023/03/31. The word "原神" is the Chinese name for Genshin Impact.

Documentation

Additional context

BelKed commented 1 year ago

If it detects only minute or two of the played/opened game, it's possibly related to: https://github.com/ActivityWatch/activitywatch/issues/124

GitPinkRabbit commented 1 year ago

A friend of mine told me it's related to the new version v0.12.2, he is using v0.12.1 and it works fine. Also I updated to the new version at 2023/04/01, which matches the evidence.

I don't know which part of logs may help.

GitPinkRabbit commented 1 year ago

If it detects only minute or two of the played/opened game, it's possibly related to: #124

It's not detecting at all.

BelKed commented 1 year ago

So then, would you mind downgrading to the v0.12.1 to confirm it works there? :)

GitPinkRabbit commented 1 year ago

So then, would you mind downgrading to the v0.12.1 to confirm it works there? :)

I downgraded to v0.12.1 today and it works fine.

image

BelKed commented 1 year ago

Thanks for confirming :)

dingwen07 commented 1 year ago

Apparently new version is not able to detect any windows with elevated rights, like Genshin.

GitPinkRabbit commented 1 year ago

Apparently new version is not able to detect any windows with elevated rights, like Genshin.

Is that intended? I‘m still using the old version, will it be fixed?

dingwen07 commented 1 year ago

Apparently new version is not able to detect any windows with elevated rights, like Genshin.

Is that intended? I‘m still using the old version, will it be fixed?

By reading the change log, the new version switched from WMI to Win32 API (https://github.com/ActivityWatch/aw-watcher-window/pull/83) to obtain window in focus, I guess it fixed the issue of high CPU usage of WMI Provider Host. That should be the cause of the behavior change.

It is expected for a program without elevated rights being unable to access programs with elevated rights. But this might not be an expected behavior of ActivityWatch.

panblue commented 1 year ago

Had the same issue with a non-Steam game: since updating, the playtime was not being tracked. Removing the Administrator rights to the game or elevating ActivityWatch rights to Administrator, both approaches solved the issue.

GitPinkRabbit commented 11 months ago

Had the same issue with a non-Steam game: since updating, the playtime was not being tracked. Removing the Administrator rights to the game or elevating ActivityWatch rights to Administrator, both approaches solved the issue.

May I ask what should I do to elevating ActivityWatch rights to Administrator?

panblue commented 11 months ago

Had the same issue with a non-Steam game: since updating, the playtime was not being tracked. Removing the Administrator rights to the game or elevating ActivityWatch rights to Administrator, both approaches solved the issue.

May I ask what should I do to elevating ActivityWatch rights to Administrator?

Sure!

Locate the ActivityWatch EXE file. For me, it was at this location: C:\Usersyour username\AppData\Local\Programs\ActivityWatch\aw-qt.exe

Right-click on the ActivityWatch EXE file > select 'Properties.' > In the 'Properties' window, go to the 'Compatibility' tab. > Tick the box that says 'Run this program as an administrator' > Apply and OK to save changes.

Hope that helps!

GitPinkRabbit commented 11 months ago

Had the same issue with a non-Steam game: since updating, the playtime was not being tracked. Removing the Administrator rights to the game or elevating ActivityWatch rights to Administrator, both approaches solved the issue.

May I ask what should I do to elevating ActivityWatch rights to Administrator?

Sure!

Locate the ActivityWatch EXE file. For me, it was at this location: C:\Usersyour username\AppData\Local\Programs\ActivityWatch\aw-qt.exe

Right-click on the ActivityWatch EXE file > select 'Properties.' > In the 'Properties' window, go to the 'Compatibility' tab. > Tick the box that says 'Run this program as an administrator' > Apply and OK to save changes.

Hope that helps!

Really appreciate that! We may need the ActivityWatch team to toggle this up automatically in the next versions?

ErikBjare commented 11 months ago

Running it as administrator is not something I'm comfortable recommending as a fix, but glad if it's working for you!

This was a regression when we updated the method of getting window titles to a faster one. We might re-add the old method of getting window titles (slower) as a fallback if the primary one fails.

ErikBjare commented 10 months ago

@BelKed Are you interested in working on the fix I suggested? To fallback to the old method if the new one fails. Should be pretty easy if you just have a look at https://github.com/ActivityWatch/aw-watcher-window/pull/83

I think it's an important fix, it not really acceptable imo that administrator rights means it doesn't get tracked. The only reason I can think of why I'm holding back on cutting a stable release right now.

I'd do it myself, but I don't have access to a Windows system. Would really appreciate it if you, or someone else, could find the time :)

BelKed commented 10 months ago

Unfortunately, I'm pretty busy with school and work at the moment, so I probably won't be able to find the time to do this. I also don't use Windows, so I probably couldn't test it properly...

ErikBjare commented 10 months ago

@BelKed I understand, just wanted to check :)

ishanfdo18098 commented 8 months ago

Had the same issue with a non-Steam game: since updating, the playtime was not being tracked. Removing the Administrator rights to the game or elevating ActivityWatch rights to Administrator, both approaches solved the issue.

ActivityWatch didnt detect Factorio (also elevated rights) too. This solved the problem (ran acitivitywatch with as admininstrator). Thank you 🙂

ErikBjare commented 8 months ago

We have a WIP fix here: https://github.com/ActivityWatch/aw-watcher-window/pull/96

Anyone with a little dev experience and access to a Windows machine is encouraged to test it :)

suiahae commented 8 months ago

We have a WIP fix here: ActivityWatch/aw-watcher-window#96

Anyone with a little dev experience and access to a Windows machine is encouraged to test it :)

Thank you for your effort! This fix works for https://github.com/ActivityWatch/activitywatch/issues/1004#issuecomment-1878185792.

But since I don't have Factorio and Genshin installed, I can't confirm if it works.