diff options
author | Manuel Schneider | 2014-04-07 15:03:16 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-04-07 15:03:16 +0200 |
commit | 207f961afbe1111814075fe3bf690f55c80b3a35 (patch) | |
tree | e72156e23d5aafc35c5e540a8576f6b0322a95b3 /remote/modules/beamergui | |
parent | [chroot.inc] Check whether anything chroot-related is mounted before trying t... (diff) | |
download | tm-scripts-207f961afbe1111814075fe3bf690f55c80b3a35.tar.gz tm-scripts-207f961afbe1111814075fe3bf690f55c80b3a35.tar.xz tm-scripts-207f961afbe1111814075fe3bf690f55c80b3a35.zip |
[beamergui] fixed wrong test...
Diffstat (limited to 'remote/modules/beamergui')
-rwxr-xr-x | remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter index 336cafc6..6c0c6466 100755 --- a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter +++ b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter @@ -1,9 +1,9 @@ #! /bin/bash # This script explicitely needs bash for the arrays -## This script adds the common resolutions to the Xserver if and only if there -## is a beamer connected. Additionally if the preferred resolution is known -## (i.e. the Xserver received a proper EDID) the latter will be applied. +# This script adds the common resolutions to the Xserver if and only if there +# is a beamer connected. Additionally, if the preferred resolution is known, +# (i.e. the Xserver received a proper EDID) the latter will be applied. ################################################################################ # Add or remove additional modes here. @@ -27,21 +27,26 @@ MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 XRANDR=$( xrandr --current ) XRANDRV=$( xrandr --current --verbose ) +echo "$XRANDR" >> /tmp/beamerlog +echo "$XRANDRV" >> /tmp/beamerlog + # Get the names of the connected outputs +# This is a rigid approach to determine the connected outputs declare -a OUTPUTNAMES while read line; do OUTPUTNAMES+=("$(echo "$line" | grep -o "^\S*" )") -done < <( echo "$XRANDR" | grep -i " connected" ) -#echo -e "Connected outputs: \e[32m${OUTPUTNAMES[@]}\e[0m" +done < <( echo "$XRANDR" | egrep ".*[[:digit:]]{1,}mm x [[:digit:]]{1,}mm" ) +echo -e "Connected outputs: \e[32m${OUTPUTNAMES[@]}\e[0m" >> /tmp/beamerlog -## The goal is to add more modelines to the X server. While this is done the +# The goal is to add more modelines to the X server. While this is done the # screen is flickering. Hence this is just necessary if there is a beamer. Do # the flickering magic only if there are two outputs and one is a projector. + +#Two outputs? if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then - if ! ( echo "$XRANDR" | egrep \ - "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm" > /dev/null \ - && echo "$XRANDR" | egrep \ - "^${OUTPUTNAMES[1]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm" > /dev/null ) + # Either of them a projector? + if ( echo "$XRANDR" | egrep "^${OUTPUTNAMES[0]}.*0mm x 0mm" > /dev/null \ + || echo "$XRANDR" | egrep "^${OUTPUTNAMES[1]}.*0mm x 0mm" > /dev/null ) then # Create all modes, so that X knows them by name "<width>x<height>" @@ -58,13 +63,12 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then done # Check which of the outputs is the beamer. - if [[ -z "$(echo "$XRANDR" | egrep \ - "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm")" ]]; then + if [ -n "$(echo "$XRANDR" | egrep "^${OUTPUTNAMES[0]}.*0mm x 0mm")" ]; then BEAMER=0; else BEAMER=1; fi - # echo -ne "${OUTPUTNAMES[$BEAMER]} is a beamer. " + echo "${OUTPUTNAMES[$BEAMER]} is a beamer. " >> /tmp/beamerlog # Finally, if the EDID is present, apply a proper resolution. # Find out whether the beamer transmits reliable EDID data. @@ -72,7 +76,7 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then if echo "$XRANDRV" | grep -Pzo \ "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ | grep EDID > /dev/null ; then - #echo "EDID present" + echo "EDID present" >> /tmp/beamerlog # If the breamer transmits the EDID there shall be a preferred resolution. OPTIMALRES=$(echo "$XRANDRV" \ @@ -87,5 +91,9 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then --output ${OUTPUTNAMES[$BEAMER]} --mode $OPTIMALRES \ --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} fi + else + echo "No beamers found." >> /tmp/beamerlog fi +else + echo "More than 2 outs." >> /tmp/beamerlog fi |