(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)
Thanks for helping out! There still seems to be an issue with the systemd service.
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8873]: Restarting Touchpad just in case
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8874]: No protocol specified
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8874]: Unable to connect to X server
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8875]: No protocol specified
Aug 23 10:59:33 yoga14s EnableTouchpad.sh[8875]: Unable to connect to X server
Aug 23 10:59:33 yoga14s systemd[1]: enabletouchpad.service: Main process exited, code=exited, status=1/FAILURE
Anyone else with the same error messages?
The command correctly restarts the touchpad after suspend. The issue seems to be on the systemd side.
A quick thing to check… … can you edit the script and replace “$USER” with your actual username and check that ? (so that it reflects the actual path, ex - /home/cscs/.Xauthority)
Ah … yes it was designed to start at first login too.
That can mean it starts too fast in that case … so in another case a ~ sleep 5 was put on the beginning because at boot the script started before the module was loaded.
But your solution makes more sense for your scenario - dont need it at boot, dont need a wait.
cheers
The unit files have no installation config (WantedBy=, RequiredBy=, Also=, Alias= settings in the [Install] section, and DefaultInstance= for template units). This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are: • A unit may be statically enabled by being symlinked from another unit's .wants/ or .requires/ directory. • A unit's purpose may be to act as a helper for some other unit which has a requirement dependency on it. • A unit may be started when needed via activation (socket, path, timer, D-Bus, udev, scripted systemctl call, ...). • In case of template units, the unit is meant to be enabled with some instance name specified.
Whereas the file ~/.config/systemd/user/restart-touchpad.service does exist and is executable (owned by me).
I had to create the directories systemd/user in my .config, so I am wondering if systemd is really looking into it. Is there some sort of user declaration to be done with systemd?
Quick question. Did you enable the service after editing the systemd file? Enabling the systemd service binds the targets to the service making it run when either suspend or hibernate is activated.
If it was already enabled, try disabling and then enabling to rebind targets.
hum…my systemd service is owned by root. Is your restart-touchpad.service owned by root or the user? If the user try chown to root:root and see if that works. If I add --user to the systemctl command it fails for me.
I followed the instructions given by cscs and the service was belonging to my user (and stored in ~/.config). With the service owned by root and stored in /etc/systemd/system/, it finally works!