Skip to content
Advertisement

Tag: screensaver

How to programmatically prevent linux computer from sleeping or turning on screensaver?

While developing a small cross-platform game on C++, I got stuck with following issue: when players are playing with a USB gamepad without touching a keyboard or mouse, the computer sleeps automatically while they’re playing. In Windows, it can be done easily using SetThreadExecutionState function. In OS X, I think it can be done with UpdateSystemActivity but not tested yet.

Advertisement