See https://github.com/wertarbyte/autorandr/issues/6
$XRANDR -q | awk -v primary_setup="${PRIMARY_SETUP}" '
# display is connected and has a mode
/^[^ ]+ connected [^(]/ {
+ output=$1
print "output "$1;
if ($3 == "primary") {
print $3
}
next;
}
+ / [0-9]+x[0-9]+ .+/ {
+ if (output) {
+ for (n=1; n<10; n++) {
+ if($n ~ /[0-9]+\.[0-9]+\*/) {
+ print "rate " gensub(/(+|\*)/, "", "g", $n);
+ }
+ }
+ }
+ }
# disconnected or disabled displays
/^[^ ]+ (dis)?connected / ||
/^[^ ]+ unknown connection / {
+ output=""
print "output "$1;
print "off";
next;