@@ -0,0 +1,2388 @@
+#!/usr/bin/python%0A#%0A# examples/dpms.py -- DPMS usage examples.%0A#%0A#    Copyright (C) 2020 Thiago Kenji Okada%3Cthiagokokada@gmail.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Lesser General Public License%0A# as published by the Free Software Foundation; either version 2.1%0A# of the License, or (at your option) any later version.%0A#%0A# This library is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.%0A# See the GNU Lesser General Public License for more details.%0A#%0A# You should have received a copy of the GNU Lesser General Public%0A# License along with this library; if not, write to the%0A#    Free Software Foundation, Inc.,%0A#    59 Temple Place,%0A#    Suite 330,%0A#    Boston, MA 02111-1307 USA%0A%0Aimport time%0A%0Afrom Xlib import display%0Afrom Xlib.ext import dpms%0A%0A%0Aclass DPMSExamples(object):%0A    def __init__(self):%0A        self.d = display.Display()%0A        # Making sure that DPMS is enabled%0A        self.d.dpms_enable()%0A        # For some reason, the call above needs another X11 call%0A        # to actually trigger it%0A        self.d.dpms_get_version()%0A%0A    def dpms_info(self):%0A        capable = self.d.dpms_capable()%0A        timeouts = self.d.dpms_get_timeouts()%0A%0A        return (capable, timeouts)%0A%0A    def turn_off_display(self):%0A        self.d.dpms_force_level(dpms.DPMSModeOff)%0A        # For some reason, the call above needs another X11 call%0A        # to actually trigger it%0A        self.d.dpms_get_version()%0A%0A    def turn_on_display(self):%0A        self.d.dpms_force_level(dpms.DPMSModeOn)%0A        # For some reason, the call above needs another X11 call%0A        # to actually trigger it%0A        self.d.dpms_get_version()%0A%0A%0Aif __name__ == '__main__':%0A    examples = DPMSExamples()%0A%0A    capable, timeouts = examples.dpms_info()%0A%0A    assert capable, 'DPMS is not supported in your system'%0A%0A    print('Current DPMS timeouts:')%0A    print('Standby: %7B%7D, Suspend: %7B%7D, Off: %7B%7D'.format(%0A        timeouts.standby_timeout,%0A        timeouts.suspend_timeout,%0A        timeouts.off_timeout%0A    ))%0A%0A    print('%5CnThe next example will turn-off your screen, press Ctrl-C to cancel.')%0A    time.sleep(2)%0A    examples.turn_off_display()%0A%0A    print('%5CnTurning it on again...')%0A    time.sleep(2)%0A    examples.turn_on_display()%0A

Add examples/dpms.py