From 190e1c0698478ed1dfd03b6a9c5ea7c452113449 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Mon, 11 Apr 2011 21:59:08 +0200 Subject: [PATCH] simplify config extraction from xrandr --- autorandr | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autorandr b/autorandr index de703b9..a8d8914 100755 --- 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; }' } -- 2.39.5