Xset – Ignore Mouse Movement When Display is Blanked

displaypower-managementscreensaverxset

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.

Best Answer

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:

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

    if [[ $status == *"Monitor is Off"* ]]; then
        xinput --disable <device>
    fi
    sleep 0.1
done
Related Question