1

I was trying to create a simple(ish) way to detect whether my laptop lid was closed and activate i3lock when it is. I know that this can be done through acpid or other methods, but I wanted to learn more about systemd timers anyway, so I went that way. It turns out that systemd has special units for timers, and one of them is for sleep, but I was unable to find anything online telling me how to do this, even on the usually amazing arch wiki. Does anyone know how to set up a service/timer to activate on these special units?

1
  • It's a target, so you would use it in, for example, a Requires= or After= declaration in your service file.
    – jasonwryan
    Jan 2, 2018 at 4:56

1 Answer 1

0

sleep.target is a target, so you name it in a WantedBy setting in your service unit file, and then enable the service.

Further reading

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .