From 393917156558574f0c3e07cccb8ea8c30cfc457f Mon Sep 17 00:00:00 2001 From: tachylatus Date: Thu, 4 Jul 2013 12:39:40 +0200 Subject: [PATCH] Fix xrandr -q parsing when output contains "primary" xRandR (in newer versions?) will output an extra columns for primary outputs. Detect this column and modify the string split and column numbers accordingly. --- autorandr | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autorandr b/autorandr index c2c3384..e38fcad 100755 --- a/autorandr +++ b/autorandr @@ -121,15 +121,22 @@ current_cfg_xrandr() { $XRANDR -q | awk -v primary_setup="${PRIMARY_SETUP}" ' # display is connected and has a mode /^[^ ]+ connected [^(]/ { - split($3, A, "+"); print "output "$1; + if ($3 == "primary") { + print $3 + split($4, A, "+") + $4=$5 + } + else { + split($3, A, "+"); + if (A[1] A[2] "," A[3] == primary_setup) + print "primary"; + } print "mode "A[1]; print "pos "A[2]"x"A[3]; if ($4 !~ /^\(/) { print "rotate "$4; } - if (A[1] A[2] "," A[3] == primary_setup) - print "primary"; next; } # disconnected or disabled displays -- 2.39.5