From f86ab89f2ed45eff4c77b7e752adc0cd41fa668d Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Thu, 12 Dec 2013 15:03:44 +0100 Subject: [beamergui] Added Xsetup script for beamergui --- .../data/etc/X11/Xsetup.d/99-beamergui-mode_setter | 93 ++++++++++++++++++++++ .../opt/openslx/scripts/beamergui-Xsetup_script | 93 ---------------------- 2 files changed, 93 insertions(+), 93 deletions(-) create mode 100755 remote/modules/beamergui/data/etc/X11/Xsetup.d/99-beamergui-mode_setter delete mode 100755 remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script (limited to 'remote/modules/beamergui') diff --git a/remote/modules/beamergui/data/etc/X11/Xsetup.d/99-beamergui-mode_setter b/remote/modules/beamergui/data/etc/X11/Xsetup.d/99-beamergui-mode_setter new file mode 100755 index 00000000..f58933e2 --- /dev/null +++ b/remote/modules/beamergui/data/etc/X11/Xsetup.d/99-beamergui-mode_setter @@ -0,0 +1,93 @@ +#! /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. If additionally the preferred resolution is known +## (i.e. the Xserver received a proper EDID) the latter will be applied. + +################################################################################ +# Add or remove additional modes here. +declare -a MODES +MODES=("${MODES[@]}" "1280x800 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync") +MODES=("${MODES[@]}" "1440x1050 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync") +MODES=("${MODES[@]}" "1680x1200 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync") +MODES=("${MODES[@]}" "1920x1200 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync") +MODES=("${MODES[@]}" "1280x720 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync") +MODES=("${MODES[@]}" "1368x768 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync") +MODES=("${MODES[@]}" "1600x900 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync") +MODES=("${MODES[@]}" "1920x1080 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync") +MODES=("${MODES[@]}" "800x600 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync") +MODES=("${MODES[@]}" "1024x768 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync") +MODES=("${MODES[@]}" "1152x864 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync") +MODES=("${MODES[@]}" "1280x960 101.25 1280 1360 1488 1696 960 963 967 996 -hsync +vsync") +MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync") +################################################################################ + +# Get initial information about the screend from xrandr +XRANDR=$( xrandr --current ) +XRANDRV=$( xrandr --current --verbose ) + +# Get the names of 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" + +## 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. +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 ) + then + + # Create all modes, so that X knows them by name "x" + for i in "${MODES[@]}"; do + xrandr --current --newmode $i > /dev/null 2>&1 + done + + # Add the modes to the outputs, this means that, if this action is + # successful they can be applied to the screens. + for i in "${OUTPUTNAMES[@]}"; do + for j in "${MODES[@]}"; do + xrandr --current --addmode $i $(echo $j| awk '{print $1;}') + done + done + + # Check which of the outputs is the beamer. Just for reference. + if [[ -z "$(echo "$XRANDR" | egrep \ + "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm")" ]]; then + BEAMER=0; + else + BEAMER=1; + fi + # echo -ne "${OUTPUTNAMES[$BEAMER]} is a beamer. " + + ## Finally if the EDID is present apply a proper resolution. + # Find out, if the beamer transmits reliable EDID data. The data in xrandr + # should be reliable if the EDID is present. + if echo "$XRANDRV" | grep -Pzo \ + "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ + | grep EDID > /dev/null ; then + + #echo "EDID present" + + + # If the breamer transmits the EDID there shall be a preferred resolution. + OPTIMALRES=$(echo "$XRANDRV" \ + | grep -Pzo "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ + | grep preferred | awk '{print $1}') + + # Apply the optimal resolution tho either of the outputs. The beamer has + # to be the secondary output. + xrandr \ + --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $OPTIMALRES \ + --primary \ + --output ${OUTPUTNAMES[$BEAMER]} --mode $OPTIMALRES \ + --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} + fi + fi +fi diff --git a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script deleted file mode 100755 index f58933e2..00000000 --- a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script +++ /dev/null @@ -1,93 +0,0 @@ -#! /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. If additionally the preferred resolution is known -## (i.e. the Xserver received a proper EDID) the latter will be applied. - -################################################################################ -# Add or remove additional modes here. -declare -a MODES -MODES=("${MODES[@]}" "1280x800 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync") -MODES=("${MODES[@]}" "1440x1050 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync") -MODES=("${MODES[@]}" "1680x1200 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync") -MODES=("${MODES[@]}" "1920x1200 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync") -MODES=("${MODES[@]}" "1280x720 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync") -MODES=("${MODES[@]}" "1368x768 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync") -MODES=("${MODES[@]}" "1600x900 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync") -MODES=("${MODES[@]}" "1920x1080 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync") -MODES=("${MODES[@]}" "800x600 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync") -MODES=("${MODES[@]}" "1024x768 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync") -MODES=("${MODES[@]}" "1152x864 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync") -MODES=("${MODES[@]}" "1280x960 101.25 1280 1360 1488 1696 960 963 967 996 -hsync +vsync") -MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync") -################################################################################ - -# Get initial information about the screend from xrandr -XRANDR=$( xrandr --current ) -XRANDRV=$( xrandr --current --verbose ) - -# Get the names of 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" - -## 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. -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 ) - then - - # Create all modes, so that X knows them by name "x" - for i in "${MODES[@]}"; do - xrandr --current --newmode $i > /dev/null 2>&1 - done - - # Add the modes to the outputs, this means that, if this action is - # successful they can be applied to the screens. - for i in "${OUTPUTNAMES[@]}"; do - for j in "${MODES[@]}"; do - xrandr --current --addmode $i $(echo $j| awk '{print $1;}') - done - done - - # Check which of the outputs is the beamer. Just for reference. - if [[ -z "$(echo "$XRANDR" | egrep \ - "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm")" ]]; then - BEAMER=0; - else - BEAMER=1; - fi - # echo -ne "${OUTPUTNAMES[$BEAMER]} is a beamer. " - - ## Finally if the EDID is present apply a proper resolution. - # Find out, if the beamer transmits reliable EDID data. The data in xrandr - # should be reliable if the EDID is present. - if echo "$XRANDRV" | grep -Pzo \ - "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ - | grep EDID > /dev/null ; then - - #echo "EDID present" - - - # If the breamer transmits the EDID there shall be a preferred resolution. - OPTIMALRES=$(echo "$XRANDRV" \ - | grep -Pzo "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ - | grep preferred | awk '{print $1}') - - # Apply the optimal resolution tho either of the outputs. The beamer has - # to be the secondary output. - xrandr \ - --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $OPTIMALRES \ - --primary \ - --output ${OUTPUTNAMES[$BEAMER]} --mode $OPTIMALRES \ - --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} - fi - fi -fi -- cgit v1.2.3-55-g7522