You are not logged in.
Hi there!
I am using lxde, I want the lxsession-logout dialog to popup when I press the powerbutton.
I followed this instruction https://wiki.archlinux.de/title/Rechner … nterfahren
( edit the /etc/acpi/handler.sh and add /sbin/halt - and this works.)
but when I add /usr/bin/lxsession-logout instead and I press the powerbutton nothing happens (while being logged in as a user and with lxde running).
so the command lxsession-logout is not executed at the righ place?! cause when I start it in a lxterminal it pops up.
Help is appreciated.
greets moere
Last edited by moere (2010-04-04 14:21:06)
Offline
The command lxsession-logout is run in the wrong context (root, no DISPLAY env var, no access to X)
The wiki article about acpid has a nice section on how to obtain and set those variables:
http://wiki.archlinux.org/index.php/Acp … nt_display
Hope it helps :-)
Regards,
raf
Offline
thank you raf_kig.
Additionally to your hint I found
http://forum.lxde.org/viewtopic.php?f=8&t=205
My /etc/acpi/handler.sh looks now like so:
getuser ()
{
export DISPLAY=`echo $DISPLAY | cut -c -2`
user=`who | grep " $DISPLAY" | awk '{print $1}' | tail -n1`
export XAUTHORITY=/home/$user/.Xauthority
eval $1=$user
}
case "$1" in
button/power)
#echo "PowerButton pressed!">/dev/tty5
case "$2" in
PWRF) logger "PowerButton pressed: $2"
getuser "$user"
echo $user > /dev/tty5
export _LXSESSION_PID=`pidof lxsession`
su $user -c "lxsession-logout" ;;
*) logger "ACPI action undefined $2" ;;
esac
;;
It even works without getting the user and starting the lxsession-logout as root by getting only the lxsession pid:
case "$1" in
button/power)
#echo "PowerButton pressed!">/dev/tty5
case "$2" in
PWRF) logger "PowerButton pressed: $2"
export _LXSESSION_PID=`pidof lxsession`
lxsession-logout ;;
*) logger "ACPI action undefined $2" ;;
esac
;;
but running the lxsession-logout as user rather than root seems to me more elegant.
greets moere
Offline