Skip to main content

Windows utility to override power requests blocking sleep/hibernate.

Project description

TODO

Implementation:

  • Bare bones timer to force sleep.
  • Update module docs as I go.
  • Lock down pypi package name.
  • Extract "Sleep after" parameter value from active power plan.
  • Add option too keep awake if audio stream detected on specific devices.
  • Add pystray system tray icon.
  • Delete note about watching for first release.

Notes:

  • To enable/disable hibernate: admin shell->powercfg /hibernate on/off
  • To test hibernate status: admin shell->powercfg /a

sleeper_service

This is a minimal Windows tray utility that enables (forces) sleep based on the active power plan "Sleep After" parameter.

For a long rant on why this exists, see the Package Rationale.

For the short version of why this exists, if you are looking for something/anything that deals with the "Legacy Kernel Caller" blocking sleep problem, hopefully this will work for you.

I'm implementing this in my spare time (hopefully only a couple of weeks to get up), so if you are interested, I suggest watch the repository for releases only and you'll be notified when the first version is available.

Change Log

v0.0.1 Proof of concept.

Package Rationale

This utility deals with the brain dead Windows implementation that allows an audio stream to block sleep. (Truly. It's genuinely stupid.)

Typical symptoms of this problem are:

  • A call to powercfg /requests will include the lines:
    [SYSTEM]
    An audio stream is currently in use.
    [DRIVER] Legacy Kernel Caller
    
  • Windows ignores sleep settings in the power plan (yeah, it's really this stupid).
  • There are no easy fixes or overrides to address the problem.

I've run into this problem with Elgato's Wave Link software (which is the trigger for writing this utility), and it has been a problem with Voicemeeter in the past (not sure if this has been resolved in more recent verions), and plenty of other software that creates an audio stream.

A quick search brings a vast range of complaints about Microsoft's bone headed implementation, but little in the way of effective, simple solutions to the problem. In particular:

  • Using powercfg /requestsoverride should allow users to prevent the Legacy Kernel Caller from blocking sleep. This flat out doesn't work. (Even if it did, Microsoft has decreed that this particular powercfg call requires elevated privileges. For a user space problem. Did I mention bone headed?).
  • There are various solutions using AutoHotKey, Visual Basic Scripts, and the Windows task manager. All are a bit opaque.

So this is yet another solution to the problem which is hopefully be relatively fire and forget, and also easy to suspend for the times you actually do want an audio stream to block sleep (rarely in my experience).

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

sleeper_service-0.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sleeper_service-0.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file sleeper_service-0.0.1.tar.gz.

File metadata

  • Download URL: sleeper_service-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for sleeper_service-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9e2692af815c3d7613c6edf3268f5c5cd0d22265bbca4853f3df74ccb2f92fed
MD5 e9bef6fca093d0def829bf504d2e49f2
BLAKE2b-256 5448da65c26c05578a875bc58e2fc817d66f84761946a2efcc6a705368c66c27

See more details on using hashes here.

File details

Details for the file sleeper_service-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sleeper_service-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38fa606065b7954cf1d0f8997a81f67e09a6f58443e3be2b1579a53d1c1d6250
MD5 ae814bdea279ee21747c33991334c971
BLAKE2b-256 a08c9f0e8a627fb5aaadb45e186398548b9b642723076c7b6c50f4a92651b7e7

See more details on using hashes here.

Supported by

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