← Back to team overview

lubuntu-desktop team mailing list archive

Re: Try to make a conclusion for lxsession-logout and screen locking.

 

On Tue, Sep 14, 2010 at 6:25 PM, Guido Berhoerster
<guido+sourceforge.net@xxxxxxxxxxxxxxxx> wrote:
> * PCMan <pcman.tw@xxxxxxxxx> [2010-09-14 06:56]:
>> No, your script didn't do the right thing.
>> If gnome-screensaver is not running, gnome-screen-saver-command
>> shouldn't be called.
>> If you do this, gnome-screen-saver will be launched, but nothing will happen.
>> At the same time it's possible that the user is actually running xscreensaver.
>
> No, running "gnome-screensaver-command -l" without
> gnome-screensaver running will print
> **Message: Screensaver is not running!
> and return exit code 1.
This is not the case on my box.
It tried to launch gnome-screensaver even if this command failed.
I'm using ubuntu 10.04.

Please read the source code of gnome-screesaver-command.
Is doesn't do what you said.

http://git.gnome.org/browse/gnome-screensaver/tree/src/gnome-screensaver-command.c

It exit with code 1 only when you pass wrong arguments, when dbus is
not available, and when you query the version number.
It return 0 even if gnome-screensaver is not running.
The dbus call, however, will cause the gnome-screensaver service being launched.
I don't know the version of gnome-screensaver you're using, but from
the latest code in git, it doesn't not work the way we want.

>> If the user is running xscreensaver, and you call
>> gnome-screensaver-command, this will result in gnome-screensaver being
>> launched and xscreensaver being bypassed, which is just the wrong
>> behavior.
>>
>> Checking if the screensaver is currently running is necessary.
>> Relying on failure of their *-command programs is not a reliable solution.
>> That's why your script is not used directly.
>
> In fact it is the exact opposite, your approach is unportable and
> completely broken in different ways.
> Firstly, pgrep will happily match the screensaver of any user
> which might be logged into the system, it will even match if
> somebody is running "vi gnome-screensaver.txt", it is thus
> completely unsuitable for the job.
Then we need a better way to check it.
> Secondly, this check is unnecessary since the exit code of
> xscreensaver-command and gnome-screensaver-command will be 1 if
> the respective screensaver is not running.
>
> --
> Guido Berhoerster
>



References