Domanda

Windows has the SetThreadExecutionState method that enables you to prevent monitor standby during program execution.

I'm searching for a Linux equivalent, but I can't find anything useful.

I don't want to disable the screensaver by calling a command, because if the program crashes after that, the screensaver will stay disabled until the user re-enables it.

The program is written in Qt, so a Qt friendly solution would be great.

Ideas anyone?

È stato utile?

Soluzione

I was looking for this and couldn't find a solution, but instead a workaround. Launching at the same time as the application (a video player) a little script to periodically check if the application process is alive, and if it isn't, re-enable the screensaver. In my case using xset s on and xset s off, then end the checker process itself. You can probably fork a process to the background so it stays alive and does its re-enable job reliably.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top