From 5aa87e350398eda1e277d3a9d542470137a87c85 Mon Sep 17 00:00:00 2001 From: Holger Paradies Date: Wed, 11 Dec 2013 20:02:33 +0100 Subject: LXDE: add script for powerbutton --- kanotix-power-button/powerbtn-kanotix.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 kanotix-power-button/powerbtn-kanotix.sh diff --git a/kanotix-power-button/powerbtn-kanotix.sh b/kanotix-power-button/powerbtn-kanotix.sh new file mode 100755 index 0000000..ed096e6 --- /dev/null +++ b/kanotix-power-button/powerbtn-kanotix.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# /etc/acpi/powerbtn-kanotix.sh + +# workaround for xfce4-power-manager in LXDE +# when power-button-is pressed and options are set to ask +# +# more info debian/README.Debian + +pidof lxsession > /dev/null || exit 1 # only start in LXDE +[ -x /usr/bin/xfce4-power-manager ] || exit 2 # only with xfce4-power-manager +pidof lxsession-logout > /dev/null && exit 3 # only start once + +getuser () + { + export DISPLAY=:0 + user=`who|awk '/'"$DISPLAY"/'{print $1}'|head -1` + logger "Powerbtn: user $user pushed powerbutton" + export XAUTHORITY=/home/$user/.Xauthority +} + +getuser "$user" +# only when option is set to ask +if grep -qs '' /home/$user/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml + then + export _LXSESSION_PID=`pidof lxsession` + logger "Powerbtn: user $user requested logout screen" + su $user -c "/usr/bin/lxde-logout" & +fi -- cgit v1.0