Sleep Countdown Reset
Delays idle timer countdown when external devices access the computer, avoiding shutdown between requests (media, data transfer, etc.)
Author: 3DDinosaur
Media servers such as Plex keep the PC awake while streaming, but idle time still accumulates. When playback ends and the request is released, Windows checks the expired idle time and sleeps immediately, leaving no time to start the next episode/media/exchange.
This mod hooks the keep-awake APIs inside each server process. Right before the server releases the request, the mod takes over with its own, for a configurable grace period or, by default, the active power plan's sleep timeout. After this period, if playback does not return, the PC sleeps normally.
Display timer and monitor state stay under Windows' control. While the grace period runs, powercfg /requests lists the mod's request under SYSTEM.
Supported servers
Included by default:
- Plex Media Server
- Emby Server (
EmbyServer.exe)
- Jellyfin (
jellyfin.exe): only with the third-party Prevent Sleep plugin, since Jellyfin alone doesn't keep the PC awake. On PCs with Modern Standby the plugin switches power plans instead, which this mod can't see.
Can be added (see below):
- Universal Media Server:
javaw.exe, with its "Prevent sleep" option set to Playback. That process name is shared by every Java program, so they all get the grace period.
- qBittorrent (
qbittorrent.exe), with "Inhibit system sleep" enabled: grace period after downloads finish.
Not needed: remote desktop and game streaming hosts (Sunshine, Parsec, Steam Remote Play). They forward the remote keyboard and mouse as local input, so Windows already counts the user as present.
Not covered: Windows file sharing (SMB). It runs inside the kernel, with no process to hook.
Adding a program
- While the program is serving, run
powercfg /requests in a terminal as administrator. The program must be listed under SYSTEM or EXECUTION.
- In Windhawk, open this mod's Advanced tab, add the executable name (e.g.
qbittorrent.exe) to the custom process inclusion list, and save.
- With debug logging enabled, the log should show
hooked SetThreadExecutionState for the new process. If the program runs as a Windows service and nothing shows up, check that Windhawk is allowed to inject into services.
Limitation
If the server process exits while holding the request, Windows drops it without any API call, and the mod can't see the release.