You are not logged in.
Is it possible to start a service after a specified time of inactivity?
I created a service that calls my screen locker automatically on suspend:
[Unit]
Description=Lock the screen on resume from suspend
[Service]
User=danilo
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/slock
[Install]
WantedBy=suspend.target
Can I also start this service after e.g. 2 minutes of inactivity?
If not – I don't really like xscreensaver, is there a more lightweight alternative?
Last edited by danilo (2013-11-19 10:02:06)
"Freedom is the freedom to say that two plus two make four. If that is granted, all else follows." - George Orwell
Offline
I use xautolock. It has served me well for over a year or so. Basically, anytime you call suspend (with systemctl) it will go through the process of activating the suspend.target. So anything hooked into the suspend.target.wants is going to run with it.
I use this:
xautolock -time 12 -locker "systemctl suspend" -detectsleep
The last "-detectsleep" part is an attempt to avoid having it double suspend. That is, it wakes up and thinks that oh, the time is now X minutes later and there was no activity... sooo suspend now! But I also have a small script in /usr/lib/systemd/system-sleep that stops xautolock and then restarts it on wake... so I have a feeling that my -detectsleep addition is fairly worthless.
Offline
A bit late, but thanks a lot! That worked perfectly
Here's a systemd service file, for people that want to use it too: https://github.com/dbrgn/dotfiles/blob/ … ck.service
"Freedom is the freedom to say that two plus two make four. If that is granted, all else follows." - George Orwell
Offline