aboutsummaryrefslogtreecommitdiffstats
path: root/bin/setup_screens
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-05-08 17:28:49 +0200
committerDavid Runge <dave@sleepmap.de>2016-05-08 17:28:49 +0200
commite75b1769e41ec37300becea5845ca7840d12e325 (patch)
treeaa41d4f7b570c166249130518e16547d64a2a1e8 /bin/setup_screens
parent5ac0d1fbba9d4c79d605da47a2050de9d62739e5 (diff)
downloaddotfiles-e75b1769e41ec37300becea5845ca7840d12e325.tar.gz
dotfiles-e75b1769e41ec37300becea5845ca7840d12e325.tar.bz2
dotfiles-e75b1769e41ec37300becea5845ca7840d12e325.tar.xz
dotfiles-e75b1769e41ec37300becea5845ca7840d12e325.zip
bin/setup_screens: Generically exporting DISPLAY and XAUTHORITY. Adding logging for journal.
Diffstat (limited to 'bin/setup_screens')
-rwxr-xr-xbin/setup_screens9
1 files changed, 8 insertions, 1 deletions
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