-
Notifications
You must be signed in to change notification settings - Fork 7
Sleep and Lock
Aurélien Ooms edited this page Dec 1, 2019
·
5 revisions
Define the two following units:
A unif for when the system goes to sleep.
/etc/systemd/system/suspend@.service
[Unit] Description=Suspend actions for user %I Before=sleep.target
[Service] User=%i Type=forking Environment=DISPLAY=:0 ExecStart=/usr/bin/env sh /home/%i/.bin/on-suspend ExecStartPost=/usr/bin/sleep 1
[Install] WantedBy=sleep.target
And a unit for when the system resumes from sleep.
/etc/systemd/system/resume@.service
[Unit] Description=Resume actions for user %I After=suspend.target
[Service] User=%i Type=simple ExecStart=/usr/bin/env sh /home/%i/.bin/on-resume
[Install] WantedBy=suspend.target
Enable suspend@username
and resume@username
.
Edit the scripts on-suspend
and on-resume
.
See also