A small software that prevents your Windows computer to enter sleep mode
nosleep.exe
will periodically send a keyboard input that mimics pressing the F15
key. The default duration between two inputs is 60 seconds.
I don't intend to publish this package on crates.io, but you can install it directly from its repository.
cargo install --git https://github.com/fvilers/nosleep.git
Manually execute the binary nosleep.exe
(should be located in %USERPROFILE%\.cargo\bin\nosleep.exe
) or ask Windows to execute it on startup.
You have several choices to execute nosleep.exe
automatically:
Create a symbolic link from the executable in the Startup folder in %APPDATA%\microsoft\Windows\Start Menu\Programs\Startup
.
Add a String value containing the path to the executable in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
.
Create a basic task triggered when the computer starts or when you log in with action set to start a program and browse to select the executable.
The executable will try to parse its first argument, if any, as an unsigned 64-bit integer and treat it as the duration in seconds to wait between two keyboard inputs.
For example:
nosleep.exe 120