From e75b1769e41ec37300becea5845ca7840d12e325 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 8 May 2016 17:28:49 +0200 Subject: bin/setup_screens: Generically exporting DISPLAY and XAUTHORITY. Adding logging for journal. --- bin/setup_screens | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/setup_screens b/bin/setup_screens index 1cdd143..995dab6 100755 --- a/bin/setup_screens +++ b/bin/setup_screens @@ -145,9 +145,15 @@ if [ "$#" -eq 1 ]; then action="$1" fi +logger "Calling 'setup_screens'" get_x_user get_current_user get_path + +# Export Xorg DISPLAY and XAUTHORITY +export DISPLAY=$(ls /tmp/.X*|grep "lock"|cut -d '.' -f2| cut -d '-' -f1|sed -e 's/X/:/') +export XAUTHORITY="$(eval echo ~$x_user/.Xauthority)" + # if the script caller is the current X user or root (and lightdm is the current X user) if [ "$current_user" = "$x_user" ] || [ $current_user = "root" -a $x_user = "lightdm" ]; then get_lid_state @@ -156,7 +162,8 @@ if [ "$current_user" = "$x_user" ] || [ $current_user = "root" -a $x_user = "lig set_configuration else if [ $current_user = "root" ]; then - runuser -l "$x_user" -c '$path' + logger "Running $path as user $x_user now." + runuser -l $x_user -c $path else echo "$current_user is not currently running X and is not allowed to let the current X user run this script." exit 1 -- cgit v1.2.3-54-g00ecf