- # Try xinit as a fallback, see bug #39
- user="`w -h | awk -vD="$D" '$7 ~ "xinit" && $0 ~ ":"D"(.[0-9])?" {print $1}' | head -n1`"
+ # This fallback checks if there is exactly one user (except
+ # root) logged in an interactive session and assumes the
+ # session belongs to him. See bug #39.
+ user="`w -hu | awk '/^\w+/ && $1 !~ "root" { users[$1]=$1; } ENDFILE { if(asort(users) == 1) for(u in users) print users[u]; }'`"