autorandr
autorandr copied to clipboard
Problem with systemd service and a better solution
With autorandr 1.8.1 I get default profile on wakeup instead of a saved one. This happens due to autorandr running too early via systemd service in sleep target.
There is a mechanism in systemd for sleep hooks specifically with ability to specify when to run action (pre|post).
Disable autorandr.service (remove sleep.target installation) and add this to /lib/systemd/system-sleep/autorandr-wakeup
#!/bin/sh
case $1 in
post)
/usr/bin/autorandr --batch --change
;;
esac
/lib/systemd/system-sleep/ is an executable file on my system. Do you potentially mean /usr/lib/systemd/system-sleep?
systemd-sleep is an executable, system-sleep is a directory.
/lib/systemd and /usr/lib/systemd are the same thing on my system since usrmerge is applied.
Fine with me. One thought though:
I've got to admit I'm getting less and less convinced that the systemd (or other system wide hooks) integration is the best course of action. I've recently used srandr and it's way more reliable for me.
What do you think about making a autorandr_launcher launched via autostart in an X11 session the default, and only using systemd if explicitly requested?
If X has a usable mechanism to listen to display events that also is reliable on wakeup, then it would be a better solution than going through device and systemd hooks.