Hello,

Here's a patch that fixes the problem, at least with Debian's version of
the "w" command.  It also changes the misspelled NOLM_DPMS_STANDBY to
NOLM_AC_DPMS_STANDBY in the defaults.

Thanks,
        Ken

--- /usr/sbin/laptop_mode.orig  2005-11-27 20:55:01.000000000 -0500
+++ /usr/sbin/laptop_mode       2006-01-14 14:11:36.000000000 -0500
@@ -83,7 +83,7 @@
        CONTROL_DPMS_STANDBY=0
        BATT_DPMS_STANDBY=300
        LM_AC_DPMS_STANDBY=1200
-       NOLM_DPMS_STANDBY=1200
+       NOLM_AC_DPMS_STANDBY=1200
        CONTROL_CPU_THROTTLING=0
        BATT_CPU_THROTTLING=medium
        LM_AC_CPU_THROTTLING=minimum
@@ -1014,11 +1014,11 @@
                        # We set screen only for users using xwindow screen. 
                        # Jerome's note: Yes, I know, there is race condition, 
                        # but have no idea for some simple solution.
-                       for USERSCREEN in `who |grep \:[0-9].*\: |awk '{print 
$1";"$2}'` ; do
-                               USER="`echo $USERSCREEN |cut -d ';' -f 1`"
-                               SCREEN="`echo $USERSCREEN |cut -d ';' -f 2`"
-                               echo "Set xwindow DPMI for user $USER: $XSET 
-display $SCREEN dpms $STANDBY $SUSPEND $OFF." > $OUTPUT
-                               su $USER -c "$XSET -display $SCREEN dpms 
$STANDBY $SUSPEND $OFF 2>&1" >$OUTPUT
+                       w -h | while read -r user tty screen REPLY; do
+                               case "$screen" in *:*)
+                                       echo "Set xwindow DPMI for user $user: 
$XSET -display $screen dpms $STANDBY $SUSPEND $OFF." > $OUTPUT
+                                       su $user -c "$XSET -display $screen 
dpms $STANDBY $SUSPEND $OFF 2>&1" >$OUTPUT
+                               esac
                        done
                        HAVEXSET="1"
                fi

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
"Parentheses?  What parentheses? I haven't noticed any parentheses
since my first month of Lisp programming.  I like to ask people who
complain about parentheses in Lisp if they are bothered by all the
spaces between words in a newspaper..." -- Kenny Tilton

Attachment: signature.asc
Description: Digital signature

Reply via email to