0

I've had enough of Windows' built-in screensaver.

I have a simple requirement: turn off the screen after X minutes of idle, which I define as:

  • No keyboard and mouse input.
  • No app is in full-screen mode.

Currently, it gets easily upset, e.g., by:

  • The xbox controller generates random clicks.
  • A game that runs in full screen but is currently suspended.

Then, I need to do something about the device or exit the game.

Is there an alternative app?


UPDATE

I wrote a python script that does all of that except for ignoring the xbox controller. Since it's an input device, its input wakes up the screen, and I don't know how to prevent that.

1 Answer 1

1

You could build your own script with AutoHotkey, for instance.

AHK makes these available for you:

  • timer to make it work in a cycle
  • several various idle variables, including one for keyboard and mouse. If that's not enough, you could manually check for limited inputs.
  • bunch of various ways to potentially detect fullscreen app, for example this or this. A 100% reliable way will be hard to find as Windows doesn't really provide that info through APIs.
  • multiple ways to launch a screensaver, e.g. by sending SC_SCREENSAVE message to launch the default one:
SendMessage, 0x112, 0xF140, 0,, Program Manager

If you'd like to use Python instead, there's e.g. inputs library that helps catching events only from specific device types, as long as they send default codes.

4
  • Thanks for that. Since it's a bit involved, I preferred to do it in python. However, there's an issue that I couldn't overcome; see my update above.
    – Zohar Levi
    Commented Apr 9 at 18:38
  • Controllers send predefined keycodes that you need to handle/ignore. Use e.g. inputs lib: github.com/zeth/inputs/blob/master/examples/keyboard_example.py
    – Destroy666
    Commented Apr 9 at 20:21
  • Oh, yeah, I can detect controller input, but the screen would turn on, and I can't prevent that. The most I can do is install a hook and turn it off immediately afterwards.
    – Zohar Levi
    Commented Apr 10 at 1:59
  • I see. That may be rather hard to get around.
    – Destroy666
    Commented Apr 10 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.