]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
pm-utils script: Check for xinit as a fallback
authorPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 7 Dec 2015 08:49:57 +0000 (09:49 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 7 Dec 2015 08:51:35 +0000 (09:51 +0100)
contrib/pm-utils/40autorandr

index 80cda11bba44f0d2a0053f387322bbc0ebcf827b..264ba5f671b15baf06e8059cbfe5bb216cfbc4ae 100755 (executable)
@@ -16,6 +16,11 @@ detect_display()
                # Prefer w to who, see bug #39
                if [ -x "`which w`" ]; then
                        user="`w -h | awk -vD="$D" '$2 ~ ":"D"(.[0-9])?$" || $3 ~ ":"D"(.[0-9])?$" {print $1}' | head -n1`"
+
+                       if [ -z "$user" ];      then
+                               # Try xinit as a fallback, see bug #39
+                               user="`w -h | awk -vD="$D" '$7 ~ "xinit" && $0 ~ ":"D"(.[0-9])?" {print $1}' | head -n1`"
+                       fi
                else
                        user="`who --all | awk -vD="$D" '$3 ~ ":"D"(.[0-9])?$" {print $1}' | head -1`"
                fi