* PCMan <pcman...@gmail.com> [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.

> 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.
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

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to