Linux – Disable Screen Saver for PyVirtualDisplay with Xephyr

linuxpython

How do I disable the screen saver for PyVirtualDisplay and xephyr?

The closest I've found is https://unix.stackexchange.com/questions/608187/xephyr-server-does-not-have-extension-for-dpms-option which says call “xset s off” from the command line. I'm running Python within an IDE so not sure how to call xset with my Python program.

I'm using CentOS 7, Python 3.9.7, and latest version of rest of packages (e.g., all updates to CentOS and updates to python packages).

My code looks like:

disp=Display(visible=1, ).start()
#selenium tests
… 
 

Best Answer

Add the "-s 0" to the xephyr command line.
In Python: disp=Display(visible=1, extra_args=['-s', '0']).start()