mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
55 lines
1.3 KiB
Diff
55 lines
1.3 KiB
Diff
# HG changeset patch
|
|
# Parent b329fa1badaa454239690c3feb93d53324134915
|
|
try to lock the screen before switching users
|
|
|
|
diff --git a/utils/gdmflexiserver b/utils/gdmflexiserver
|
|
--- a/utils/gdmflexiserver
|
|
+++ b/utils/gdmflexiserver
|
|
@@ -9,9 +9,47 @@
|
|
#
|
|
# See http://www.gnu.org/copyleft/gpl.html for the full text of the license.
|
|
|
|
+PATH=/usr/local/bin:/bin:/usr/bin
|
|
+export PATH
|
|
+
|
|
if [ -z "$XDG_SEAT_PATH" ]; then
|
|
# something went wrong
|
|
exit 1
|
|
fi
|
|
|
|
+find_command () {
|
|
+ cmd="$1"
|
|
+ oIFS="${IFS}"; IFS=:
|
|
+ set -- ${PATH}
|
|
+ IFS="${oIFS}"
|
|
+
|
|
+ for part; do
|
|
+ [ -x "${part}/${cmd}" ] && return 0
|
|
+ done
|
|
+ return 1
|
|
+}
|
|
+
|
|
+lock_screen () {
|
|
+ for lock_cmd in \
|
|
+ "xscreensaver-command -lock" \
|
|
+ "gnome-screensaver-command --lock" \
|
|
+ "dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call /ScreenSaver org.freedesktop.ScreenSaver.Lock"
|
|
+ do
|
|
+ ${lock_cmd} >/dev/null 2>&1 && return
|
|
+ done
|
|
+
|
|
+ for lock_cmd in \
|
|
+ "slock" \
|
|
+ "xlock -mode blank"
|
|
+ do
|
|
+ set -- ${lock_cmd}
|
|
+ if find_command "$1"; then
|
|
+ ${lock_cmd} >/dev/null 2>&1 &
|
|
+ return
|
|
+ fi
|
|
+ done
|
|
+}
|
|
+
|
|
+lock_screen
|
|
+
|
|
dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DisplayManager $XDG_SEAT_PATH org.freedesktop.DisplayManager.Seat.SwitchToGreeter
|