diff options
author | Holger Paradies <retabell@gmx.de> | 2013-12-11 20:02:33 +0100 |
---|---|---|
committer | Holger Paradies <retabell@gmx.de> | 2013-12-11 20:28:12 +0100 |
commit | 5aa87e350398eda1e277d3a9d542470137a87c85 (patch) | |
tree | 5a6edb65df99f9b92c827daf1dd5f7356164c871 /kanotix-power-button | |
parent | d7d33445f9bf4b251bb8e9c7a0ddd0fad1eeb7ae (diff) | |
download | kanotix-packages-5aa87e350398eda1e277d3a9d542470137a87c85.zip kanotix-packages-5aa87e350398eda1e277d3a9d542470137a87c85.tar.gz |
LXDE: add script for powerbutton
Diffstat (limited to 'kanotix-power-button')
-rwxr-xr-x | kanotix-power-button/powerbtn-kanotix.sh | 29 |
1 files changed, 29 insertions, 0 deletions
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 '<property name="power-button-action" type="uint" value="3"/>' /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 |