]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Updated pm-utils scripts
authorhelterscelter <http://differentframeofmind.blogspot.com/>
Mon, 6 Aug 2012 19:08:08 +0000 (15:08 -0400)
committerhelterscelter <http://differentframeofmind.blogspot.com/>
Mon, 6 Aug 2012 19:08:08 +0000 (15:08 -0400)
40autorandr had issues when resuming on a system where
one or more users have multiple terminal sessions open.

enhanced 40autorandr to allow being called as 40auto-disper
to automatically swap to using auto-disper semantics

pm-utils/40auto-disper [new symlink]
pm-utils/40autorandr

diff --git a/pm-utils/40auto-disper b/pm-utils/40auto-disper
new file mode 120000 (symlink)
index 0000000..9d7b227
--- /dev/null
@@ -0,0 +1 @@
+40autorandr
\ No newline at end of file
index 60ca9ae8f374b3d4d9a1ab144863428758f546fb..f465b06d4d4bdb6d8395bb6e79999bb49b2958a3 100755 (executable)
@@ -2,22 +2,35 @@
 #
 # 40autorandr: Change autorandr profile on thaw/resume
 
-AUTORANDR="autorandr -c"
+# 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"
 
 detect_display()
 {
        for X in /tmp/.X11-unix/X*; do
                D="${X##/tmp/.X11-unix/X}"
-               user=$(who | awk -vD="$D" '$5 ~ "\\(:"D"\\)$" {print $1}')
+               user=$( who | grep  \(:$D\) | cut -d ' ' -sf 1 | uniq )
+               echo "Checking $X -- $D - $user"
                if [ x"$user" != x"" ]; then
+                       echo "AUTORANDR $D - $user"
                        export DISPLAY=":$D"
                        /bin/su -c "${AUTORANDR}" "$user"
                fi
        done
+       echo "Done"
 }
 
 case "$1" in
        thaw|resume)
-               detect_display
+               detect_display 
                ;;
 esac