1#!/bin/sh 2# 3# xfce4 4# 5# Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@xfce.org) 6# Copyright (C) 2011 Guido Berhoerster (guido+xfce.org@berhoerster.name) 7# Copyright (C) 2011 Jarno Suni (8@iki.fi) 8# 9# This program is free software; you can redistribute it and/or modify 10# it under the terms of the GNU General Public License as published by 11# the Free Software Foundation; either version 2 of the License, or 12# (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program; if not, write to the Free Software 21# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22# 23 24# First test for the command set in the session's xfconf channel 25LOCK_CMD=$(xfconf-query -c xfce4-session -p /general/LockCommand) 26 27# Lock by xscreensaver or gnome-screensaver, if a respective daemon is running 28for lock_cmd in \ 29 "$LOCK_CMD" \ 30 "xfce4-screensaver-command --lock" \ 31 "xscreensaver-command -lock" \ 32 "gnome-screensaver-command --lock" 33do 34 if [ ! -z "$lock_cmd" ]; then 35 $lock_cmd >/dev/null 2>&1 && exit 36 fi 37done 38 39# else run another access locking utility, if installed 40for lock_cmd in \ 41 "xlock -mode blank" \ 42 "slock" \ 43 "i3lock -c 000000" 44 do 45 set -- $lock_cmd 46 if command -v -- $1 >/dev/null 2>&1; then 47 $lock_cmd >/dev/null 2>&1 & 48 # turn off display backlight: 49 sleep 1 50 xset dpms force off 51 exit 52 fi 53done 54 55# else access locking failed 56exit 1 57