Skip to content

Commit 2c05e75

Browse files
committed
Replace unfinished lightdm method in lxlock by xscreensaver method, which also auto start the daemon if it's not running
1 parent d6a0d49 commit 2c05e75

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lxlock/lxlock

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
# Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@xfce.org)
55
# Copyright (C) 2012 Julien Lavergne (gilir@ubuntu.com)
6+
# Copyright (C) 2013 Jarno Suni (8@iki.fi)
67
#
78
# This program is free software; you can redistribute it and/or modify
89
# it under the terms of the GNU General Public License as published by
@@ -20,16 +21,16 @@
2021
#
2122

2223
# Try to lock the screen with thos applications (in this order) :
23-
# lighdtm, xscreensaver, gnome-screensaver, slock, slock, i3lock and xdg-screensaver
24+
# xscreensaver, gnome-screensaver, slock, slock, i3lock and xdg-screensaver
2425

25-
if test x"`which dm-tool 2>/dev/null`" != x""; then
26-
dm-tool switch-to-greeter
27-
elif `dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.freedesktop.DisplayManager > /dev/null 2>&1` ; then
28-
seat="$XDG_SEAT_PATH"
29-
dbus-send --system --print-reply --dest=org.freedesktop.DisplayManager "$seat" org.freedesktop.DisplayManager.Seat.SwitchToGreeter \
30-
2> /dev/null
31-
elif test x"`which xscreensaver-command 2>/dev/null`" != x""; then
32-
xscreensaver-command -lock
26+
if test x"`which xscreensaver-command 2>/dev/null`" != x""; then
27+
xscreensaver-command -lock
28+
xscreensaver-command -lock >/dev/null 2>&1 ||
29+
(
30+
# Probably the daemon was not running. Start the daemon and retry.
31+
xscreensaver -nosplash >/dev/null 2>&1 &
32+
xscreensaver-command -lock >/dev/null 2>&1
33+
)
3334
elif test x"`which gnome-screensaver-command 2>/dev/null`" != x""; then
3435
gnome-screensaver-command --lock
3536
elif test x"`which slock 2>/dev/null`" != x""; then

0 commit comments

Comments
 (0)