You are not logged in.

#1 2013-05-13 22:17:46

MicroJoe
Member
From: France
Registered: 2012-06-10
Posts: 14
Website

[SOLVED] XScreenSaver autolock on suspend

Hi all,

I've tried to make my XScreenSaver lock when suspending but it seems not to work at all. I followed these instructions on the wiki and created the following xscreensaver.service :

[Unit]
Description=Lock X session using xscreensaver
Before=sleep.target

[Service]
Type=oneshot
ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock

[Install]
WantedBy=sleep.target

But when activating this service through systemd, I got the following status error :

[root@netbook romain]# systemctl status xscreensaver.service
xscreensaver.service - Lock X session using xscreensaver
   Loaded: loaded (/etc/systemd/system/xscreensaver.service; enabled)
   Active: failed (Result: exit-code) since mar. 2013-05-14 00:13:10 UTC; 11s ago
  Process: 16130 ExecStart=/usr/bin/xuserrun /usr/bin/xscreensaver-command -lock (code=exited, status=2)

mai 14 00:13:10 netbook systemd[1]: xscreensaver.service: main process exited, code=exited, status=2/INVALIDARGUMENT
mai 14 00:13:10 netbook systemd[1]: Failed to start Lock X session using xscreensaver.
mai 14 00:13:10 netbook systemd[1]: Unit xscreensaver.service entered failed state.

And if I try to launch the command in ExecStart manually as regular user, I got the following :

Error: Active session is not x11

Any ideas ?

Thanks for reply, 
MicroJoe.

Last edited by MicroJoe (2013-05-14 13:02:31)

Offline

#2 2013-05-13 23:41:23

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [SOLVED] XScreenSaver autolock on suspend

Sanity check: You did install xuserrun, yes?  What is the output of "which xuserrun"?

Offline

#3 2013-05-14 04:54:07

MicroJoe
Member
From: France
Registered: 2012-06-10
Posts: 14
Website

Re: [SOLVED] XScreenSaver autolock on suspend

Yes, I installed it through the xuserrun-git package avaible on AUR as recommanded on the wiki :

$ which xuserrun
/usr/bin/xuserrun

I tried to install a stabler version using the xuserrun package on AUR instead but it lead to the same results. If I can't launch the command because of not detecting the x11 server, the problem may be from the xuserrun program ?

I saw this issue on xuserrun's Github repository and I tried to copy/paste the solution in a /opt/xuserrun file. I got the same error of x11 session not detected and if I try to remove the check-x11-is-active-else-return-thing in the script and call it with the xscreensaver-command -lock program, I got the following from XScreenSaver :

romain@netbook ~ » /opt/xuserrun /usr/bin/xscreensaver-command -lock
xscreensaver-command: can't open display

sad

Last edited by MicroJoe (2013-05-14 05:11:24)

Offline

#4 2013-05-14 09:39:04

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,060
Website

Re: [SOLVED] XScreenSaver autolock on suspend

I suggest to change the service file like this:

[Service]
User=microjoe
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/screensaver-command -lock

Last edited by teateawhy (2013-05-14 09:39:22)

Offline

#5 2013-05-14 10:22:28

Raynman
Member
Registered: 2011-10-22
Posts: 1,094

Re: [SOLVED] XScreenSaver autolock on suspend

teateawhy wrote:

I suggest to change the service file like this:

[Service]
User=microjoe
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/screensaver-command -lock

As far as I know, xscreensaver-command does no forking. Stick with Type=oneshot.

Offline

#6 2013-05-14 13:01:14

MicroJoe
Member
From: France
Registered: 2012-06-10
Posts: 14
Website

Re: [SOLVED] XScreenSaver autolock on suspend

Thanks ! It works well using teateawhy's Service except I kept the oneshot.
What about the wiki? Do you think I should edit it to post this solution as a subtitute for the actual one?

(Meanwhile, querying « XScreenSaver autolock » on Google leads directly to this topic created yesterday ; impressive)

Offline

Board footer

Powered by FluxBB