Skip to content

xrandr 1.4.2 and the "primary" flag #35

@jnsnow

Description

@jnsnow

autorandr does not appear to be able to handle xrandr 1.4.2's printing of the "primary" flag, because it always expects the mode and offset to be $3.

However, as seen in e.g. Fedora 20:
eDP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 175mm

primary might be $3, and mode/offset is $4, and $5 if present would be the rotation.

I wrote a quick hack for this:

diff --git a/autorandr b/autorandr
index c2c3384..5a61ca8 100755
--- a/autorandr
+++ b/autorandr
@@ -122,11 +122,17 @@ current_cfg_xrandr() {
        # display is connected and has a mode
        /^[^ ]+ connected [^(]/ {
                split($3, A, "+");
+               R = $4;
                print "output "$1;
+               if ($3 == "primary") {
+                       print "primary";
+                       split($4, A, "+");
+                       R = $5
+               }
                print "mode "A[1];
                print "pos "A[2]"x"A[3];
-               if ($4 !~ /^\(/) {
-                       print "rotate "$4;
+               if (R !~ /^\(/) {
+                       print "rotate "R;
                }
                if (A[1] A[2] "," A[3] == primary_setup)
                        print "primary";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions