User Tools

Site Tools


howto:preventsuspend

Prevent suspend mode when lid is closed (Xandros Full Desktop)

When the computer lid is closed, the system executes the script /etc/acpi/lidbtn.sh, the contents of which should look something like this:

#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
 
if [ $LID_STATE = "closed" ] ; then
        /etc/acpi/suspend2ram.sh
fi
exit 0

Preventing suspend mode unconditionally

To unconditionally prevent the system from entering suspend mode when the lid is closed, edit the file and comment out the line which invokes the suspend2ram.sh command by prepending a #:

if [ $LID_STATE = "closed" ] ; then
#        /etc/acpi/suspend2ram.sh
fi

Preventing suspend mode when the Music Manager is playing

One annoyance of the Eee is that you can't use it as a portable audio player, since it immediately enters suspend mode once the lid is closed. If you use the default Music Manager application, this limitation can be overcome by modifying the lidbtn.sh script to check if an audio file is playing. The command

dcop --all-sessions --user user amarok player isPlaying

will output “true” if the Music Manager is running and currently playing. So we modify the script in two places: first, we add a line to run the dcop command and store its output in a variable, and second, we update the if statement to check the value of this variable. The modified script is as follows:

#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
AMAROK_PLAYING=`dcop --all-sessions --user user amarok player isPlaying`
 
if [ $LID_STATE = "closed" -a "$AMAROK_PLAYING" != "true" ] ; then
        /etc/acpi/suspend2ram.sh
fi
exit 0

See also

howto/preventsuspend.txt · Last modified: 2008/11/05 16:25 by psychonaut