From f56637d56b8a3d41e34fa8ba396f8286ac50821d Mon Sep 17 00:00:00 2001 From: maho Date: Mon, 8 Apr 2013 18:45:29 +0200 Subject: [PATCH] - turn off each display separately, because it's the only way to turn off LVDS and turn on HDMI+VGA combo --- autorandr | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/autorandr b/autorandr index c2c3384..881cd4c 100755 --- a/autorandr +++ b/autorandr @@ -45,6 +45,7 @@ # and saving/loading the current configuration are adjusted accordingly. XRANDR=/usr/bin/xrandr +#XRANDR=debug_xrandr DISPER=/usr/bin/disper XDPYINFO=/usr/bin/xdpyinfo PROFILES=~/.autorandr/ @@ -166,8 +167,35 @@ config_equal() { fi } +debug_xrandr() { + echo "DEBUG: calling xrandr $@" + xrandr "$@" +} + load_cfg_xrandr() { - sed 's!^!--!' "$1" | xargs $XRANDR + #it's not possible to turn off LVDS1 and turn on HDMI1 in one command. It + # should be splitted to per-display commands + + OPTIONS=$( + awk ' /^output/ { print ARGS; ARGS=""; } + + END { print ARGS; ARGS=""; } + + { ARGS=ARGS" --"$0; } + ' < "$1") + + #first - options which turn off displays + { + echo "$OPTIONS" | grep -- "--off"; + echo "$OPTIONS" | grep -v -- "--off" + } | while read LINE;do + if [ -n "$LINE" ];then + $XRANDR $LINE; + fi + done + + +# sed 's!^!--!' "$1" | xargs $XRANDR } load_cfg_disper() { @@ -179,6 +207,7 @@ load() { local CONF="$PROFILES/$PROFILE/config" if [ -e "$CONF" ] ; then echo " -> loading profile $PROFILE" + #echo "DEBUG: LOAD_METHOD=$LOAD_METHOD CONF=$CONF" $LOAD_METHOD "$CONF" [ -x "$PROFILES/$PROFILE/postswitch" ] && \