Skip to main content

Keep your OS from sleeping (supports Windows and macOS)

Project description

adrenaline

Simple Python module to prevent your computer from going to sleep. Supports Windows and macOS at the moment; Linux support is coming soon (hopefully).

Usage

The module provides a context manager named prevent_sleep(). The computer will not go to sleep while the execution is in this context:

from adrenaline import prevent_sleep


with prevent_sleep():
    # do something important here
    ...

Optionally, you can also prevent the screen from turning off:

with prevent_sleep(display=True):
    # do something important here
    ...

Command line interface

You can also use this module from the command line as follows:

$ python -m adrenaline

The command line interface will prevent sleep mode as long as it is running.

Acknowledgments

Thanks to Michael Lynn for figuring out how to do this on macOS.

Thanks to Niko Pasanen for the Windows version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adrenaline-3.0.0.tar.gz (6.5 kB view hashes)

Uploaded source

Built Distribution

adrenaline-3.0.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page