]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - pm-utils/40autorandr
Updated pm-utils scripts
[deb_pkgs/autorandr.git] / pm-utils / 40autorandr
1 #!/bin/sh
2 #
3 # 40autorandr: Change autorandr profile on thaw/resume
4
5 # detect if we are being called as 40auto-disper or 40autorandr
6 FORM=${0##*40}
7 case $FORM in
8         auto-disper)
9                 AUTORANDR="auto-disper -c"
10                 ;;
11         *)
12                 AUTORANDR="autorandr -c"
13                 ;;
14 esac
15 echo "$AUTORANDR"
16
17 detect_display()
18 {
19         for X in /tmp/.X11-unix/X*; do
20                 D="${X##/tmp/.X11-unix/X}"
21                 user=$( who | grep  \(:$D\) | cut -d ' ' -sf 1 | uniq )
22                 echo "Checking $X -- $D - $user"
23                 if [ x"$user" != x"" ]; then
24                         echo "AUTORANDR $D - $user"
25                         export DISPLAY=":$D"
26                         /bin/su -c "${AUTORANDR}" "$user"
27                 fi
28         done
29         echo "Done"
30 }
31
32 case "$1" in
33         thaw|resume)
34                 detect_display 
35                 ;;
36 esac