From: Hermann Kraus Date: Sun, 17 Nov 2013 23:33:18 +0000 (+0100) Subject: Make user name detection more reliable if there are multiple session (e.g. terminals). X-Git-Tag: 1.0~155^2~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5e3a9c5ec45c1c3adaf3503eae87d3fbd300b168;p=deb_pkgs%2Fautorandr.git Make user name detection more reliable if there are multiple session (e.g. terminals). --- diff --git a/pm-utils/40autorandr b/pm-utils/40autorandr index 1dcb856..43c1766 100755 --- a/pm-utils/40autorandr +++ b/pm-utils/40autorandr @@ -9,8 +9,8 @@ detect_display() { for X in /tmp/.X11-unix/X*; do D="${X##/tmp/.X11-unix/X}" - user=`w -h | awk -vD="$D" '$3 ~ ":"D"(\\.[0-9])?$" {print $1}'` - logger "user $user" + user=$(w -h | awk -vD="$D" '$3 ~ ":"D"(\\.[0-9])?$" {print $1}' | head -1) + logger "autorandr: Changing display configuration for user '$user'" if [ x"$user" != x"" ]; then export DISPLAY=":$D" /bin/su -c "${AUTORANDR}" "$user"