You are not logged in.
Hi all,
I'm using a systemd service to enable i3lock after waking up from suspend. The file /etc/systemd/system/i3lock.service looks like:
[Unit]
Description=i3lock on suspend
Before=sleep.target
[Service]
User=hensen
Type=forking
Environment=DISPLAY=:1
ExecStart=/bin/lock
[Install]
WantedBy=sleep.target
However, the DISPLAY environment of the system is set to :0 or :1 randomly on startup, causing the service to fail sometimes. Can someone tell me what's going on here, and any solutions to this problem?
Thanks,
R
Last edited by roghnin (2017-07-02 05:09:25)
Offline
First, this should be a user service. Second, see the wiki.
(also please use [ code ] tags for commands/output/file-contents on the forums).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
First, this should be a user service. Second, see the wiki.
(also please use [ code ] tags for commands/output/file-contents on the forums).
Cool. Problem solved. Thanks, Trilby.
BTW, it's easy to forget removing "User=Somebody" when switching the service from system to user.
Offline