Power button does not display lxde-logout
Posted: Sun Mar 21, 2010 12:40 pm
Hello all, having a problem here that I simply cannot get to the bottom of.
I would like the lxde-logout window to be displayed when I press the power button, rather than have the computer immediately shut down. This is on a Toshiba Satellite A30.
I've installed gnome-power-manager, edited the .desktop file to "OnlyShowIn=LXDE", and I've set the power button action in the preferences to "Ask me". I've had a look at /etc/acpi/powerbtn.sh and cannot see the problem - it looks exactly the same as the powerbtn.sh from my XFCE install on another partition (which works as it should). I tried replacing the last line with "lxde-logout", but it stopped the power button from doing anything at all. However, if I double click the powerbtn.sh script, the lxde-logout displays as it should - it just doesn't work with the power button itself.
I've seen the two suggestions in this post...
http://forum.lxde.org/viewtopic.php?f=8&t=205
...the first one didn't work, and the second one didn't make much sense to me as my powerbtn.sh looks really different to the one shown in the above post, so I haven't tried it. Can anybody suggest how I should use this advice for my particular powerbtn.sh script?
Below is the powerbtn.sh script, I would very much appreciate any help. Cheers.
I would like the lxde-logout window to be displayed when I press the power button, rather than have the computer immediately shut down. This is on a Toshiba Satellite A30.
I've installed gnome-power-manager, edited the .desktop file to "OnlyShowIn=LXDE", and I've set the power button action in the preferences to "Ask me". I've had a look at /etc/acpi/powerbtn.sh and cannot see the problem - it looks exactly the same as the powerbtn.sh from my XFCE install on another partition (which works as it should). I tried replacing the last line with "lxde-logout", but it stopped the power button from doing anything at all. However, if I double click the powerbtn.sh script, the lxde-logout displays as it should - it just doesn't work with the power button itself.
I've seen the two suggestions in this post...
http://forum.lxde.org/viewtopic.php?f=8&t=205
...the first one didn't work, and the second one didn't make much sense to me as my powerbtn.sh looks really different to the one shown in the above post, so I haven't tried it. Can anybody suggest how I should use this advice for my particular powerbtn.sh script?
Below is the powerbtn.sh script, I would very much appreciate any help. Cheers.
Code: Select all
#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.
# Skip if we just in the middle of resuming.
test -f /var/lock/acpisleep && exit 0
# If gnome-power-manager, kpowersave or klaptopdaemon are running, let
# them handle policy This is effectively the same as 'acpi-support's
# '/usr/share/acpi-support/policy-funcs' file.
if pidof gnome-power-manager kpowersave > /dev/null ||
(pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop kded kded loadedModules | grep -q klaptopdaemon) ; then
exit
fi
# Otherwise, if KDE is found, try to ask it to logout.
# If KDE is not found, just shutdown now.
if ps -Af | grep -q '[k]desktop' && pidof dcopserver > /dev/null && test -x /usr/bin/dcop ; then
KDESES=`pidof dcopserver | wc -w`
if [ $KDESES -eq 1 ] ; then
# single KDE session -> ask user
/usr/bin/dcop --all-sessions --all-users ksmserver ksmserver logout 1 2 0
exit 0
else
# more than one KDE session - just send shutdown signal to all of them
/usr/bin/dcop --all-sessions --all-users ksmserver ksmserver logout 0 2 0 && exit 0
fi
fi
# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"