Sunday, January 18, 2009

Removing the dialog box when pressing the hardware shutdown button (on an eeePC with default Xandros)

This page suggests different ways to remove the shutdown dialog box. It will be removed both when the hardware button is pressed and when the software button on the taskbar is pressed. But I'd like to remove it only for the hardware button and leave the rest unchanged. So I edited /etc/acpi/powerbtn.sh (changes are in bold) to comment out the call to shutdown_dialog and insert the call to fastshutdown.sh, instead:
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
then
dcop --all-sessions --all-users ksmserver ksmserver logout 1 2 2 && exit 0
elif ps -Af | grep -q 'AsusLauncher'
then
if [ ! -f /home/user/.doingLogin ]
then
DISPLAY=:0 su -c /opt/xandros/bin/shutdown_dialog user &
fi
else
/bin/kill -SIGUSR2 1
fi
to become:
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop
then
dcop --all-sessions --all-users ksmserver ksmserver logout 1 2 2 && exit 0
elif ps -Af | grep -q 'AsusLauncher'
then
if [ ! -f /home/user/.doingLogin ]
then
sudo fastshutdown.sh
# DISPLAY=:0 su -c /opt/xandros/bin/shutdown_dialog user &
fi
else
/bin/kill -SIGUSR2 1
fi