DPMS, keep screen off when lid shut
- by Evan Teran
I have a laptop running linux. In my xorg configuration, I have DPMS setup so that the screen automatically turns off during several events. In addition to that I have to the following script tied to ACPI lid open/close events:
#!/bin/sh
for i in $(pidof X); do
CMD=$(ps --no-heading $i)
XAUTH="$(echo $CMD | sed -n 's/.*-auth \(.*\)/\1/p')"
DISPLAY="$(echo $CMD | sed -n 's/.* \(:[0-9]\) .*/\1/p')"
# turn the display off or back on
export XAUTHORITY=$XAUTH
/usr/bin/xset -display $DISPLAY dpms force $1
done
Basically, this script takes one parameter ("on" or "off") then iterates through all of my running X sessions and either turns on or turns off the monitor.
Here's my issue. When I close the lid of the laptop, the screen goes off as expected, but if a mouse event occurs (like if something bumps into the table...) then the screen turns back on even though it is closed (I can see the light through the side of the laptop).
Is there a way to prevent the screen from turning on during a mouse event if the lid is closed?