]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
detect primary screen and save to config.
authorMaciej Sitarz <macieksitarz@wp.pl>
Sat, 11 Feb 2012 21:17:06 +0000 (22:17 +0100)
committerStefan Tomanek <stefan.tomanek@wertarbyte.de>
Sun, 12 Feb 2012 22:06:25 +0000 (23:06 +0100)
autorandr

index a8d8914e5f2369d561adcb8fd10f900ddadbc97b..89d5e25609a6310ff514f304fa9c115bb681767d 100755 (executable)
--- a/autorandr
+++ b/autorandr
@@ -113,13 +113,16 @@ setup_fp() {
 }
 
 current_cfg_xrandr() {
-       $XRANDR -q | awk '
+       local PRIMARY_SETUP=$(xdpyinfo -ext XINERAMA|awk '/^  head #0:/ {printf $3 $5}')
+       $XRANDR -q | awk -v primary_setup=${PRIMARY_SETUP} '
        # display is connected and has a mode
        /^[^ ]+ connected [^(]/ {
                split($3, A, "+");
                print "output "$1;
                print "mode "A[1];
                print "pos "A[2]"x"A[3];
+               if (A[1] A[2] "," A[3] == primary_setup)
+                       print "primary";
                next;
        }
        # disconnected or disabled displays