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
|
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)
|
|
|
|
AUTORANDR="auto-disper -c"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AUTORANDR="autorandr -c"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "$AUTORANDR"
|
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}"
|
2012-08-06 19:08:08 +00:00
|
|
|
user=$( who | grep \(:$D\) | cut -d ' ' -sf 1 | uniq )
|
|
|
|
echo "Checking $X -- $D - $user"
|
2012-01-18 21:07:01 +00:00
|
|
|
if [ x"$user" != x"" ]; then
|
2012-08-06 19:08:08 +00:00
|
|
|
echo "AUTORANDR $D - $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
|
2012-08-06 19:08:08 +00:00
|
|
|
echo "Done"
|
2012-01-18 21:07:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
thaw|resume)
|
2012-08-06 19:08:08 +00:00
|
|
|
detect_display
|
2012-01-18 21:07:01 +00:00
|
|
|
;;
|
|
|
|
esac
|