]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
simplify config extraction from xrandr
authorStefan Tomanek <stefan.tomanek@wertarbyte.de>
Mon, 11 Apr 2011 19:59:08 +0000 (21:59 +0200)
committerStefan Tomanek <stefan.tomanek@wertarbyte.de>
Mon, 11 Apr 2011 19:59:08 +0000 (21:59 +0200)
autorandr

index de703b9ad2f8ed38e2daa5d307ee80807b5e0db2..a8d8914e5f2369d561adcb8fd10f900ddadbc97b 100755 (executable)
--- a/autorandr
+++ b/autorandr
@@ -114,19 +114,19 @@ setup_fp() {
 
 current_cfg_xrandr() {
        $XRANDR -q | awk '
-       /^[^ ]+ disconnected / {
-        print "output "$1;
-               print "off";
-       }
-       /^[^ ]+ connected \(/ {
-               print "output "$1;
-               print "off";
-       }
+       # 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];
+               next;
+       }
+       # disconnected or disabled displays
+       /^[^ ]+ (dis)?connected / {
+               print "output "$1;
+               print "off";
+               next;
        }'
 }