context: my laptop does not offer option to disable wakeup from mouse movement in bios and an option in KDE is nowhere to be found.
I've agregated many posts from various places online to make a hopefully easy way to disable permanently this behaviour without side effect nor hacks.
- find your mouse with
udevadm info
# list your available mouse inputs
ls /dev/input/mouse*
# print mouse info
udevadm info --name=/dev/input/mouse0
# if not the mouse you're looking for, check the next from the previous list (e.g. mouse1, mouse2, ...)you can also find your mouse with this script but imo it's not needed (except if you have a ludicrous amount of mice plugged-in).
The first line shoud be something like :
P: /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:3434:D030.0001/input/input4/mouse0
Here, the "PCI id" (as I call it) is 0000:00:14.0 (it's the next value after the pcixxx:xx part).
With it, you can check the file /proc/acpi/wakeup and find the line with the PCI id in the last column.
e.g. :
$ cat /proc/acpi/wakeup
Device S-state Status Sysfs node
...
XHCI S3 *enabled pci:0000:00:14.0
...
Here, my mouse is listed as device XHCI.
With this, create a conf file in /etc/tmpfiles.d/, name it something recognisable just in case (mine is disable-keychron-mouse-wakeup.conf), and put this inside :
# Path Mode UID GID Age Argument
w+ /proc/acpi/wakeup - - - - XHCI
Of course, replace the Argument part with your device "code".
Then run sudo systemd-tmpfiles --create.
If no problem has occured, you can check /proc/acpi/wakeup again and you shoud get :
$ cat /proc/acpi/wakeup
Device S-state Status Sysfs node
...
XHCI S3 *disabled pci:0000:00:14.0
...
Try waking your device from sleep with your mouse and nothing should happen.
Then, just to be sure, reboot and try again.
taken from various places, including but not limited to :