quickie script

Jack Coates <[email protected]>
Newsgroups gmane.linux.hardware.sony
Organization Monkeynoodle.Org
Message-ID <[email protected]>
Got tired of accidentally hitting the power button which is oh-so-close
to delete.

/etc/acpi/events/power :
...
# shut down when power button is pressed
event=button/power.*
action=/usr/local/sbin/halt-dialog

/usr/local/sbin/halt-dialog :
#!/bin/sh
export DISPLAY=":0.0"
RESULTS=`Xdialog --screen-center --default-no --yesno "The system is
about to shut down, do you want to continue?" 10 50`
EXIT_CODE=$?
case $EXIT_CODE in
        0) /sbin/halt
        ;;
        1) exit
        ;;
        255) exit
        ;;
esac

[jack@chupacabra jack]$ grep xhost .xfce/*
.xfce/xfwmrc:+ "I" Exec xhost +

Note that I use a local firewall to block X requests from the network,
if you don't have a firewall installed on your laptop you'd better make
that xhost +localhost. If you're using some window manager other than
XFce, put xhost in its startup, not XFce's :-)

-- 
Jack Coates
Monkeynoodle: A Scientific Venture...
http://www.monkeynoodle.org/resume.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.