Giter VIP home page Giter VIP logo

python-dpms's Introduction

This project is abandoned

python-xlib has DPMS support now. It also doesn't need Xlib libraries installed to compile it, that is always a plus.

If you want to continue using this fork or the original project, it is fine, but remember that there is no license so the usage of this code in a project is unclear. python-xlib is properly licensed by LGPL v.2.1 or later: https://github.com/python-xlib/python-xlib/blob/master/LICENSE.

Here is an example on how to use DPMS with python-xlib: https://github.com/python-xlib/python-xlib/blob/733556f8b40b2d2643830ac193a0ffdd6560dbfc/examples/dpms.py.

About

Test

This are Python bindings to the DPMS X11 extension module for controlling your monitor power savings state.

The DPMS interface lets you control the power level of your monitor (On, Standby, Suspend, or Off). It is a simple interface that lets you get/set timeouts of inactivity to enter these states or you can force it to enter any of the states.

See example.py on how to use it. This file should be sufficient on how to use it. It first shows how to query all the different settings and then shows how to set them.

See also man xset for a program that lets you modify the DPMS state from the command line.

These are bindings to the DPMS X11 extension module and as such only work from within an X11 session. They do not work from a console outside of X11.

Install

Install libXext and python development packages installed. For example, on RedHat/Fedora:

# yum install libXext-devel python-devel

On Ubuntu:

# apt-get install libxext6-dev python-dev

On Arch Linux:

# pacman -S libxext python

On NixOS, use the provided shell.nix file:

# This will setup everything, no need to build/install later
$ nix-shell

Then run:

$ python setup.py build

Then as root, run:

# python setup.py install

If you prefer, you can also build it inside a venv, without root:

$ python -m venv venv
$ source venv/bin/activate
$ python setup.py install

That's it. Now run:

$ python scripts/example.py

to test it out. Also try the turnoff.py script:

$ python scripts/turnoff.py

It should turn off your monitor after a 1 second wait. Press any key to wake it back up.

Compatibility

This is a fork of python-dpms, porting it to Python 3. It also include some bugfixes.

python-dpms's People

Contributors

dirjud avatar thiagokokada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.