dgamelaunch
dgamelaunch copied to clipboard
Track idle by input
Currently dgamelaunch checks the mtime of the ttyrec to determine idle time of games for the watching games menu. Some games continue to update the screen while the user is idle (e.g. NetHack-setseed with realtime UI-clock enabled on the status bar), which results in idle games being displayed as active.
This PR introduces an additional file in the inprogressdir, which is the same as the lockfile path but with '.in' appended. Any user input is copied live to this file. The watch menu checks the mtime of this file instead, to show the idle timer for a given game. Additional routines were implemented to clean up this extra file, and to exclude it from being treated as a lockfile. This is because currently all files in inprogressdir are treated as lockfiles. With this PR, those ending in '.in' are excluded, and also removed if they are orphans (if the same file without the '.in' suffix does not exist, they are considered orphans).