]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - contrib/pm-utils/40autorandr
Moved contributed scripts/files to the contrib/ folder and updated the Makefile to...
[deb_pkgs/autorandr.git] / contrib / pm-utils / 40autorandr
1 #!/bin/sh
2 #
3 # 40autorandr: Change autorandr profile on thaw/resume
4 exec > /var/log/autorandr.log 2>&1
5
6 AUTORANDR="autorandr -c --default default"
7
8 detect_display()
9 {
10         for X in /tmp/.X11-unix/X*; do
11                 D="${X##/tmp/.X11-unix/X}"
12                 user=`who | awk -vD="$D" '$2 ~ ":"D"(.[0-9])?$" {print $1}' | head -1`
13                 if [ x"$user" != x"" ]; then
14                         logger "autorandr: Changing display configuration for user '$user'"
15                         export DISPLAY=":$D"
16                         /bin/su -c "${AUTORANDR}" "$user"
17                 fi
18         done
19 }
20
21 case "$1" in
22         thaw|resume)
23                 detect_display
24                 ;;
25 esac