On my laptop, the connected external monitor does not come out of sleep unless I run
xset dpms force off. Since this annoys me, I was looking to run this command automatically on every resume.
I found that I was able to create the file
/etc/systemd/system/[email protected] with the commands to run automatically.
[Unit] Description=%I resume actions After=suspend.target [Service] User=%I Type=simple ExecStartPre=/usr/bin/xset -display :0 dpms force off ExecStart=/usr/bin/xset -display :0 dpms force on [Install] WantedBy=suspend.target
Followed by enabling the service.
# systemctl enable [email protected] Created symlink from /etc/systemd/system/suspend.target.wants/[email protected] to /etc/systemd/system/[email protected]
Now when the laptop resumes from sleep, the xset commands are run for me.