I develop [cross-platform C++ Qt-based] application which plays video using libVLC. When i watch video for a long time, my monitor is going to turn off according with power management settings. I want to disable auto turning off while video is playing as it is in Totem, VLC media player and other Ubuntu media players. But i can't find how to do this from C++ code using Ubuntu libraries.
For example, under Windows i can do that using:
SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS );
Everything i found about Linux/Ubuntu is how to patch some config files. I can't do this from code:
- User that run app obiously may have no rights to edit configs
- Power settings must be restored anyway when video stops but if my app suddenly crashed it will not happen
- Different Ubuntu versions may have different config files and entries
So my questions:
- is there a some Ubuntu (or Qt and libVLC) library functions which suppress monitor turning off and system sleep?
- how popular Ubuntu video players implements such behaviour?