I can blank/turn off display on my laptop with following command:

xset dpms force off

then, any mouse movement or keyboard press "wakes up" the display.

Is it possible to ignore mouse movements, and only unblank the screen on keyboard action?

If this is not possible in xset at the moment, I would welcome any suggestion how to patch the sourcecode.

I am using Debian 10.

  • 1
    I think you'd have to modify X11 server (typically Xorg this day) to do what you want. Feb 16, 2021 at 19:10
  • Low level code as idle interruption detection are usually compiled functions. I doubt screensavers have their independent idle detector which you can edit without affecting other processes Feb 17, 2021 at 11:49
  • Just pinning this.
    – BlueManCZ
    Feb 18, 2021 at 10:48
  • @BlueManCZ: is this much different from the provided answer? Feb 19, 2021 at 10:33

2 Answers 2


A work around could be having a service running xset q to determine whether monitor is on/off. If off, disable mouse/touchpad and if on enable it back again.

To enable/disable first get your mouse/touchpad id with

xinput -list

Then use

xinput --disable <device>

Service should run something like this:

while true; do
    status="$(xset q)"
    if [[ $status == *"Monitor is On"* ]]; then
        xinput --enable <device>

    if [[ $status == *"Monitor is Off"* ]]; then
        xinput --disable <device>
    sleep 0.1
  • thank you for the suggestion, but this is extremely ugly hack. There must be better way to do it, even if it requires patching the source code. Feb 15, 2021 at 7:04
  • 2
    It is not a solution. It is a work around. Feb 16, 2021 at 13:09

In Debian 10 gnome-screensaver-command -a can be used to enable blank screen (I set this up as a shortcut to Win-Shift-L). Mouse movement and modifier keys will turn the monitors back on but won't exit gnome-screensaver unless a normal key is pressed or a mouse button is clicked (or dragged?). Monitors turn back off after a very short delay while in gnome-screensaver.

Blank screen can also be done automatically after a delay the same way you would normally lock the screen automatically, just disable Automatic Screen Lock in Gnome Settings

Unfortunately the curtain appears to go away on mouse movements alone (and even other reasons?) in Gnome 3.38 (Debian 11 Bullseye); the net effect is that if anything unblanks the screen I get back to the desktop with normal blank timeout (set at 10 minutes for me, and this happens quite often even while I'm not at my computer at all) instead of blanking back after just a few seconds. I'm still looking for a way to re-enable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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