/usr/bin/restart-touchpad.sh
#!/bin/bash
echo "Restarting Touchpad just in case"
declare -x DISPLAY=":0.0"
declare -x XAUTHORITY="/home/"$USER"/.Xauthority"
xinput disable 'PNP0C50:00 06CB:CDB0 Touchpad'
xinput enable 'PNP0C50:00 06CB:CDB0 Touchpad'
(you may need to make this file executable with sudo chmod +x /usr/bin/restart-touchpad.sh
)
~/.config/systemd/user/restart-touchpad.service
[Unit]
Description=Restart Touchpad
After=basic.target suspend.target hibernate.target
[Service]
Type=oneshot
Environment=DISPLAY=:0
ExecStart=/usr/bin/restart-touchpad.sh
WantedBy=basic.target suspend.target hibernate.target
Then enable it:
systemctl enable restart-touchpad.service --user --now
Let me know how it goes. I think it should work
(EDIT - it seems some users may need to replace “$USER” in the above script with their actual username to reflect the actual path, ex: /home/cscs/.Xauthority
)