Description: check which screensaver is running (and not only installed)
Author: Yves-Alexis Perez <corsac@debian.org>
Bug: https://bugzilla.xfce.org/show_bug.cgi?id=3770

diff --git a/scripts/xflock4 b/scripts/xflock4
index fcf3323..c61b8e1 100644
--- a/scripts/xflock4
+++ b/scripts/xflock4
@@ -19,9 +19,9 @@
 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
-if test x"`which xscreensaver-command 2>/dev/null`" != x""; then
+if pgrep xscreensaver > /dev/null 2>&1; then
     xscreensaver-command -lock 
-elif test x"`which gnome-screensaver-command 2>/dev/null`" != x""; then
+elif pgrep -f gnome-screensaver 2>/dev/null; then
     gnome-screensaver-command --lock
 elif test x"`which slock 2>/dev/null`" != x""; then
    slock
