]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - pm-utils/40autorandr
Add support for "preswitch" scripts
[deb_pkgs/autorandr.git] / pm-utils / 40autorandr
1 #!/bin/sh
2 #
3 # 40autorandr: Change autorandr profile on thaw/resume
4
5 AUTORANDR="autorandr -c"
6
7 detect_display()
8 {
9         for X in /tmp/.X11-unix/X*; do
10                 D="${X##/tmp/.X11-unix/X}"
11                 user=$(who | awk -vD="$D" '$5 ~ "\\(:"D"\\)$" {print $1}')
12                 if [ x"$user" != x"" ]; then
13                         export DISPLAY=":$D"
14                         /bin/su -c "${AUTORANDR}" "$user"
15                 fi
16         done
17 }
18
19 case "$1" in
20         thaw|resume)
21                 detect_display
22                 ;;
23 esac