From b0349e529709e42311ea2f63801ffd84740281ad Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Wed, 9 Sep 2015 09:09:55 +0200 Subject: [PATCH] acpid: generate user env variables --- srcpkgs/acpid/files/handler.sh | 13 ++++++++++++- srcpkgs/acpid/template | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh index 136537271f..c1ea64ec59 100644 --- a/srcpkgs/acpid/files/handler.sh +++ b/srcpkgs/acpid/files/handler.sh @@ -10,6 +10,17 @@ setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed" set $* +PID=$(pgrep dbus-launch) +USER=$(ps -o user --no-headers $PID) +USERHOME=$(getent passwd $USER | cut -d: -f6) +export XAUTHORITY="$USERHOME/.Xauthority" +for x in /tmp/.X11-unix/*; do + displaynum=`echo $x | sed s#/tmp/.X11-unix/X##` + if [ x"$XAUTHORITY" != x"" ]; then + export DISPLAY=":$displaynum" + fi +done + case "$1" in button/power) #echo "PowerButton pressed!">/dev/tty5 @@ -58,7 +69,7 @@ case "$1" in ;; esac ;; - CPU0) + CPU0) ;; *) logger "ACPI action undefined: $2" ;; esac diff --git a/srcpkgs/acpid/template b/srcpkgs/acpid/template index 1f463fae38..84fa98e0f8 100644 --- a/srcpkgs/acpid/template +++ b/srcpkgs/acpid/template @@ -1,7 +1,7 @@ # Template file for 'acpid' pkgname=acpid version=2.0.25 -revision=1 +revision=2 build_pie=yes build_style=gnu-configure configure_args="--sbindir=/usr/bin"