From: Maciej Sitarz Date: Sat, 11 Feb 2012 21:17:06 +0000 (+0100) Subject: detect primary screen and save to config. X-Git-Tag: 1.0~168 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8f54947a041ab8d6641a18407957fd0c3c122b65;p=deb_pkgs%2Fautorandr.git detect primary screen and save to config. --- diff --git a/autorandr b/autorandr index a8d8914..89d5e25 100755 --- a/autorandr +++ b/autorandr @@ -113,13 +113,16 @@ setup_fp() { } current_cfg_xrandr() { - $XRANDR -q | awk ' + local PRIMARY_SETUP=$(xdpyinfo -ext XINERAMA|awk '/^ head #0:/ {printf $3 $5}') + $XRANDR -q | awk -v primary_setup=${PRIMARY_SETUP} ' # 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]; + if (A[1] A[2] "," A[3] == primary_setup) + print "primary"; next; } # disconnected or disabled displays