[Pkg-acpi-devel] Bug#605276: support for xlock and xtrlock

Santiago Garcia Mantinan manty at debian.org
Tue Nov 29 17:29:35 UTC 2011


Tags: patch

I've tried to address the lack of support of xtrlock and xlock giving
preference to xlock as it protects the contents of the screen and thus the
privacy, which xtrlock doesn't. I call xlock with -remote and -mode blank in
order to be able to lock any kind of displays with the less energy
disipated, but maybe the -remote doesn't make any sense in a typical acpi
use.

This is just a example that works for me (tested both xtrlock and xlock) but
as such it is just a sugestion.

In the patch I'm also addressing the point 1 issue on bug #649562 ($XUSER vs
$user), otherwise at least on my setup it ended up running the commands as
root.

--- screenblank	2011-11-29 17:57:31.071842669 +0100
+++ /usr/share/acpi-support/screenblank	2011-11-29 18:13:17.824407093 +0100
@@ -1,7 +1,7 @@
 if pidof xscreensaver >/dev/null; then
-	su $user -s /bin/sh -c "xscreensaver-command -throttle &"
+	su $XUSER -s /bin/sh -c "xscreensaver-command -throttle &"
 		if [ x$LOCK_SCREEN = xtrue ]; then	
-		su $user -s /bin/sh -c "xscreensaver-command -lock &"
+		su $XUSER -s /bin/sh -c "xscreensaver-command -lock &"
 	fi
 elif pidof dcopserver >/dev/null; then
 	if [ x$LOCK_SCREEN = xtrue ]; then
@@ -12,14 +12,22 @@
 		    	dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1
     		done
 	fi
+else
+  if [ x$LOCK_SCREEN = xtrue ]; then
+     if [ -x /usr/bin/xlock ]; then
+        su $XUSER -s /bin/sh -c "/usr/bin/xlock -remote -mode blank &"
+     elif [ -x /usr/bin/xtrlock ]; then
+	su $XUSER -s /bin/sh -c "/usr/bin/xtrlock &"
+     fi
+  fi
 fi
 
 case "$DISPLAY_DPMS" in
   xset)
-su $user -s /bin/sh -c "xset dpms force off &"
+su $XUSER -s /bin/sh -c "xset dpms force off &"
 	;;
   xrandr)
-	su $user -s /bin/sh -c "xrandr --output LVDS --off"
+	su $XUSER -s /bin/sh -c "xrandr --output LVDS --off"
 	;;
   vbetool)
 	/usr/sbin/vbetool dpms off

-- 
Manty/BestiaTester -> http://manty.net







More information about the Pkg-acpi-devel mailing list