wertarbyte / autorandr

Auto-detect the connect display hardware and load the appropiate X11 setup using xrandr or disper
648 stars 63 forks source link

xrandr output does not match awk pattern #37

Open PostalBear opened 9 years ago

PostalBear commented 9 years ago

Hi, First of all thanks for this nice script.

During attempt to make my monitor configuration switching I discovered that xrandr output does not match awk pattern , which leads to creation of incorrect configuration profile.

In my case output of xrandr -q looks like this:

eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm

Which results to corrupted configuration profile:

output eDP1
mode primary
pos x
rotate 1920x1080+0+0  

To provide you with more information: I'm using Ubuntu 14.04.3 LTS on Lenovo T450s with Intel GPU. That's output of xrandr --version

xrandr program version       1.4.1
Server reports RandR version 1.4

I was able to fix this problem quite easy by adjusting awk pattern:

    # display is connected and has a mode
    /^[^ ]+ connected [^(]/ {
        split($4, A, "+");
        print "output "$1;
        print "mode "A[1];
        print "pos "A[2]"x"A[3];
        if ($5 !~ /^\(/) {
            print "rotate "$5;
        }
phillipberndt commented 9 years ago

Have a look at #36