]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Merge remote-tracking branches 'tachylatus/master' and 'herm/master'
authorPhillip Berndt <phillip.berndt@googlemail.com>
Fri, 29 Nov 2013 06:43:48 +0000 (07:43 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Fri, 29 Nov 2013 06:43:48 +0000 (07:43 +0100)
Makefile [new file with mode: 0644]
README
pm-utils/40autorandr
udev/40-monitor-hotplug.rules [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..41494fa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+all:
+       @echo "Call \"make install\" to install this program."
+       @echo "Call \"make hotplug\" to install matching hotplug events."
+
+INSTALL_PATH=/usr/local/bin
+install:
+       install auto-disper ${INSTALL_PATH}
+       install -m 755 autorandr ${INSTALL_PATH}
+       install -m 644 bash_completion/autorandr /etc/bash_completion.d/
+
+hotplug:
+       install -m 755 pm-utils/40autorandr /etc/pm/sleep.d/
+       install -m 644 udev/40-monitor-hotplug.rules /etc/udev/rules.d/
+       udevadm control --reload-rules
\ No newline at end of file
diff --git a/README b/README
index 9b54600b765a28801171d2ff8a7cad6619efe994..32a32b7d9d5a09f7f99681d8429873c1516998c2 100644 (file)
--- a/README
+++ b/README
@@ -44,3 +44,6 @@ or "auto-disper" forces it to use the "disper" utility, which is useful for
 controlling nvidia chipsets. The formats for fingerprinting the current setup
 and saving/loading the current configuration are adjusted accordingly.
 
+To install autorandr call "make install", define your setup and then call 
+"make hotplug" to install hotplug scripts.
+
index 60ca9ae8f374b3d4d9a1ab144863428758f546fb..43c17667f814bdfcded67a2060aeabe1bc630de1 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # 40autorandr: Change autorandr profile on thaw/resume
+exec > /var/log/autorandr.log 2>&1
 
 AUTORANDR="autorandr -c"
 
@@ -8,7 +9,8 @@ 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=$(w -h | awk -vD="$D" '$3 ~ ":"D"(\\.[0-9])?$" {print $1}' | head -1)
+               logger "autorandr: Changing display configuration for user '$user'"
                if [ x"$user" != x"" ]; then
                        export DISPLAY=":$D"
                        /bin/su -c "${AUTORANDR}" "$user"
diff --git a/udev/40-monitor-hotplug.rules b/udev/40-monitor-hotplug.rules
new file mode 100644 (file)
index 0000000..4c48ffb
--- /dev/null
@@ -0,0 +1 @@
+ACTION=="change", SUBSYSTEM=="drm", RUN+="/etc/pm/sleep.d/40autorandr thaw"