itch
itch copied to clipboard
Niche Feature Request: Account for system sleep time in Playtime Tracking
This is primarily for the Steam Deck: I like how the launcher tracks playing time for our games. Like most launchers though, it doesn't notice when the system is asleep. So, if you:
- play a game for thirty minutes,
- put the system to sleep while the game is running
- leave it that way for 24 hours,
- wake the system,
- play another half an hour
- quit,
the launcher thinks you've been playing the game for 25 hours instead of one.
This isn't common behavior on most PCs but it is very common behavior on a Steam Deck. The Steam Deck handles this for Steam games by noting when the system is asleep and subtracting that time from playtime after the game has been exited. Might something similar be possible for the itch.io app?
You can run the itch.io app on a Steam Deck 😲? I need to read those blog posts more (or get myself a Steam Deck 😜).
I actually searched in the code for how this computation is done but couldn't find it. I mean it seems to be here https://github.com/itchio/butler/blob/50d55e90a90f4d03b5cfc7d35d135b30584c91a7/database/models/cave.go#L86-L89
func (c *Cave) RecordPlayTime(playTime time.Duration) {
c.SecondsRun += int64(playTime.Seconds())
c.Touch()
}
but I can't find the receiver RecordPlayTime
to be called on a cave instance anywhere. I expected it somewhere not far from launching a game https://github.com/itchio/itch/blob/105041c6dabf596a5f3243c0c732326ee9102eaf/src/main/reactors/launch/perform-launch.ts#L69C1-L75C13
await mcall(
messages.Launch,
{
caveId: cave.id,
prereqsDir,
sandbox: preferences.isolateApps,
},