-
Notifications
You must be signed in to change notification settings - Fork 7
Sleep and Lock
Aurélien Ooms edited this page Dec 5, 2019
·
5 revisions
Define the two following units:
A unit for when the system goes to sleep.
# /etc/systemd/system/[email protected]
[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/[email protected]
[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