diff options
author | Manuel Schneider | 2013-12-12 11:32:48 +0100 |
---|---|---|
committer | Manuel Schneider | 2013-12-12 11:32:48 +0100 |
commit | 4b5e54e7e0804c82e70c6cae2bcc56f5f33890f9 (patch) | |
tree | 0450bd14f7d9b524f9ed7b0d236724cc8c27ad4d /remote/modules/beamergui | |
parent | [rootfs-stage32] add macvtap module to wanted kernel module list (diff) | |
download | tm-scripts-4b5e54e7e0804c82e70c6cae2bcc56f5f33890f9.tar.gz tm-scripts-4b5e54e7e0804c82e70c6cae2bcc56f5f33890f9.tar.xz tm-scripts-4b5e54e7e0804c82e70c6cae2bcc56f5f33890f9.zip |
Initial setup file which is to be called from xsetup
Diffstat (limited to 'remote/modules/beamergui')
3 files changed, 93 insertions, 44 deletions
diff --git a/remote/modules/beamergui/TODO b/remote/modules/beamergui/TODO deleted file mode 100644 index 651759eb..00000000 --- a/remote/modules/beamergui/TODO +++ /dev/null @@ -1,2 +0,0 @@ -Zenity durch eigen QT app ersetzen - diff --git a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script new file mode 100755 index 00000000..f58933e2 --- /dev/null +++ b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-Xsetup_script @@ -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 "<width>x<height>" + 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-x_mode_setter b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-x_mode_setter deleted file mode 100755 index ae81b280..00000000 --- a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-x_mode_setter +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# List all modes -declare -a MODES -#16:10 -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[@]}" "2560x1600 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync") -#16:9 -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[@]}" "2560x1440 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync") -#4:3 -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[@]}" "1400x1050 121.75 1400 1488 1632 1864 1050 1053 1057 1089 -hsync +vsync") - -# Create all modes -for i in "${MODES[@]}"; do - #echo -e "\e[32mxrandr --current --newmode $i\e[0m" - xrandr --current --newmode $i > /dev/null 2>&1 -done - -# Get the connected outputs -declare -a OUTPUTNAMES -while read line; do - OUTPUTNAMES+=("$(echo "$line" | grep -o "^\S*" )") -done < <( xrandr | grep -i " connected" ) - -# Add the modes to all outputs -for i in "${OUTPUTNAMES[@]}"; do - for j in "${MODES[@]}"; do - #echo -e "\e[32mxrandr --current --addmode $i $(echo $j| awk '{print $1;}')\e[0m" - xrandr --current --addmode $i $(echo $j| awk '{print $1;}') - done -done |