You can diagnose this by closing your laptop almost fully so that the screen shuts off but you can still see it. Move your mouse around and if your screen turns on you have your problem
This script uses an ACPI event for the screen closing to fix this issue. This is made for the ASUS Zenbook 14 but will probably work with minor changes to other laptops
Follow the instructions at the top to set it up
(i only kind of know what im doing so lmk if this doesnt work for you)
Code: Select all
#!/bin/bash
#┌────────────────────────────────────────┐
#│Solves the problem of laptop waking │
#│up while suspended due to getting input │
#│from the mouse │
#│ │
#│Needs to be set up with ACPI to start │
#│when the lid closes │
#│ │
#│Should not run while the laptop is in │
#│use, only when the lid is closed │
#│ │
#│v1.1 │
#└────────────────────────────────────────┘
#┌────────────────────────────────────────────────────┐
#│To set up, add the following to │
#│/etc/acpi/events/lid-close-mouse-disable │
#│ │
#│ event=button/lid.* │
#│ action=/etc/acpi/lid-close-mouse-disable.sh %e │
#│ │
#│Then, put this script in │
#│/etc/acpi/lid-close-mouse-disable.sh │
#│ │
#│There are some more variables you have to set below │
#└────────────────────────────────────────────────────┘
# run xinput list
# then, find your mouse id and put it here
# possibly when you plug in more devices this changes
device=9
# use whereis to make sure these paths are right
cat=/usr/bin/cat
grep=/usr/bin/grep
xinput=/usr/bin/xinput
systemctl=/usr/bin/systemctl
sleep=/usr/bin/sleep
# path that stores the state of your lid
# might say LID instead of LID0 or some other path entirely
# script depends on this file containing "open" when open
lidstate=/proc/acpi/button/lid/LID0/state
# run env | grep Xauthority
# put that value here
export XAUTHORITY=/home/probably-your-name-here/.Xauthority
#====== do not edit after here ======#
# xinput needs these
export DISPLAY=:0
# this script runs when a close event or an open event
# no need to do anything for an open event
echo $1 | grep open
if [ $? -eq 0 ]; then
exit
fi
while :; do
$cat $lidstate | $grep open
if [ $? -ne 0 ]; then
# lid closed
$xinput disable $device
$systemctl suspend
else
# lid open
$xinput enable $device
exit
fi
$sleep 1
done