3 # 40autorandr: Change autorandr profile on thaw/resume
4 exec > /var/log/autorandr.log 2>&1
6 AUTORANDR="autorandr -c --default default"
10 # Wait for the system to recognize the changed state, see bug #30
11 # Note the ampersand below, this runs asynchroneously.
14 for X in /tmp/.X11-unix/X*; do
15 D="${X##/tmp/.X11-unix/X}"
16 # Prefer w to who, see bug #39
17 if [ -x "`which w`" ]; then
18 user="`w -h | awk -vD="$D" '$2 ~ ":"D"(.[0-9])?$" || $3 ~ ":"D"(.[0-9])?$" {print $1}' | head -n1`"
20 user="`who --all | awk -vD="$D" '$3 ~ ":"D"(.[0-9])?$" {print $1}' | head -1`"
23 if [ x"$user" != x"" ]; then
24 logger "autorandr: Changing display configuration for user '$user'"
26 /bin/su -c "${AUTORANDR}" "$user"