autorandr/pm-utils/40autorandr

26 lines
531 B
Bash
Executable File

#!/bin/sh
#
# 40autorandr: Change autorandr profile on thaw/resume
exec > /var/log/autorandr.log 2>&1
AUTORANDR="autorandr -c --default default"
detect_display()
{
for X in /tmp/.X11-unix/X*; do
D="${X##/tmp/.X11-unix/X}"
user=`who | awk -vD="$D" '$2 ~ ":"D"(.[0-9])?$" {print $1}' | head -1`
if [ x"$user" != x"" ]; then
logger "autorandr: Changing display configuration for user '$user'"
export DISPLAY=":$D"
/bin/su -c "${AUTORANDR}" "$user"
fi
done
}
case "$1" in
thaw|resume)
detect_display
;;
esac