From: Stefan Tomanek Date: Mon, 11 Apr 2011 19:59:08 +0000 (+0200) Subject: simplify config extraction from xrandr X-Git-Tag: 1.0~169 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=190e1c0698478ed1dfd03b6a9c5ea7c452113449;p=deb_pkgs%2Fautorandr.git simplify config extraction from xrandr --- 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; }' }