2012-01-18 21:07:01 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2012-02-15 19:53:13 +00:00
|
|
|
# 40autorandr: Change autorandr profile on thaw/resume
|
2013-04-10 18:05:26 +00:00
|
|
|
exec > /var/log/autorandr.log 2>&1
|
2012-01-18 21:07:01 +00:00
|
|
|
|
2012-08-06 19:08:08 +00:00
|
|
|
# detect if we are being called as 40auto-disper or 40autorandr
|
|
|
|
FORM=${0##*40}
|
|
|
|
case $FORM in
|
|
|
|
auto-disper)
|
2013-04-24 14:15:19 +00:00
|
|
|
AUTORANDR="auto-disper -c --default default"
|
2012-08-06 19:08:08 +00:00
|
|
|
;;
|
|
|
|
*)
|
2013-12-02 09:42:23 +00:00
|
|
|
AUTORANDR="autorandr -c --default default"
|
2012-08-06 19:08:08 +00:00
|
|
|
;;
|
|
|
|
esac
|
2012-01-18 21:07:01 +00:00
|
|
|
|
|
|
|
detect_display()
|
|
|
|
{
|
2012-02-12 22:22:19 +00:00
|
|
|
for X in /tmp/.X11-unix/X*; do
|
|
|
|
D="${X##/tmp/.X11-unix/X}"
|
2013-11-17 23:33:18 +00:00
|
|
|
user=$(w -h | awk -vD="$D" '$3 ~ ":"D"(\\.[0-9])?$" {print $1}' | head -1)
|
2012-01-18 21:07:01 +00:00
|
|
|
if [ x"$user" != x"" ]; then
|
2013-11-29 07:04:18 +00:00
|
|
|
logger "autorandr: Changing display configuration for user '$user'"
|
2012-02-15 19:53:13 +00:00
|
|
|
export DISPLAY=":$D"
|
2012-01-18 21:07:01 +00:00
|
|
|
/bin/su -c "${AUTORANDR}" "$user"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
thaw|resume)
|
|
|
|
detect_display
|
|
|
|
;;
|
|
|
|
esac
|