1

I am using slim login manager on Debian 10.

slim-1.3.6

part of the slim package is slimlock, a screenlocker. When I lock my screen (Ctrl+Alt+Del), two things happen:

  1. typical lock screen appears, where I have to provide password to unlock
  2. after few seconds my display goes to sleep

When I then come back and either move mouse, or type on keyboard, then the display wakes up and the lock screen appears again, where I can type my password to unlock.

I need to change the following:

When screen is locked and display is asleep, do not wake up on mouse movements. Only when I type on keyboard should the display wake up, and the lock screen password dialog appear.

How can I do this?

Does this need to be patched in the slim/slimlock package, or is this xserver ?

I would be happy to recompile the slim package, if somebody could kindly point me what to modify and where.

400 the Cat
  • 819
  • 4
  • 37
  • 85

1 Answers1

2

Mouse movements cause the DPMS extension in the X11 server to wakeup the monitor. One way to stop this is to disable the mouse device before starting slimlock and re-enabling it afterwards. First find the name of the mouse using xinput --list. For me it was Logitech USB Optical Mouse. You can then disable it with

dev='Logitech USB Optical Mouse'
xinput --disable "$dev"

On returning from slimlock use the same command with --enable instead.

If you need the mouse to become active again once you start using the keyboard, for example to click some icon, you will need to poll the state of the monitor and notice when it turns on, indicating use of the keyboard. You can do this with, say,

while xset q | grep -q 'Monitor is Off'
do sleep 15
done
xinput --enable "$dev"

To avoid this immediately detecting that the monitor is on at the start, you might want to add a suitable sleep before this loop.

meuh
  • 49,672
  • 2
  • 52
  • 114
  • thank you, but this looks like an ugly workaround. Is there a way to patch X11/dpms to ignore mouse movements when asleep? – 400 the Cat Jun 19 '21 at 04:46
  • @400theCat It's open source software so of course you could change all software. However, in all likelihood you don't want to. Perhaps you go to the website/git repo of the source code and make a suggestion in their bugtracker for this improvement. Meanwhile, this looks like a good fix. You only need to set it up once and it won't be accepted by updates (as would a fork of the source code). – Ned64 Jun 19 '21 at 10:52