User Tools

Site Tools


systemd-resume

systemd Suspend Resume Hook

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 resume@ian
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.

systemd-resume.txt · Last modified: 2020/02/13 22:55 (external edit)

free spam filter