summaryrefslogtreecommitdiffstats
path: root/core/modules/beamergui
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-15 14:40:26 +0100
committerSimon Rettberg2017-12-15 14:40:26 +0100
commit1517b96229ad4ce635e093bcc6b26712dcbc5d10 (patch)
tree929d4d9fb6c896b94c65c68faf54392ccb9e78b9 /core/modules/beamergui
parent[run-virt] Support %loginuser% in netshares (diff)
downloadmltk-1517b96229ad4ce635e093bcc6b26712dcbc5d10.tar.gz
mltk-1517b96229ad4ce635e093bcc6b26712dcbc5d10.tar.xz
mltk-1517b96229ad4ce635e093bcc6b26712dcbc5d10.zip
[beamergui] cmake now, fix greps in setup
Diffstat (limited to 'core/modules/beamergui')
-rwxr-xr-xcore/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter92
-rw-r--r--core/modules/beamergui/module.build9
2 files changed, 48 insertions, 53 deletions
diff --git a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
index a66ea979..fdc2416d 100755
--- a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
+++ b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
@@ -8,19 +8,17 @@
################################################################################
# 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[@]}" "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[@]}" "1280x720 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync")
+MODES=("${MODES[@]}" "1280x800 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync")
+MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync")
MODES=("${MODES[@]}" "1368x768 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync")
+MODES=("${MODES[@]}" "1440x1050 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync")
MODES=("${MODES[@]}" "1600x900 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync")
+MODES=("${MODES[@]}" "1680x1050 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -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")
+MODES=("${MODES[@]}" "1920x1200 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync")
################################################################################
CONFIGFILE="/opt/openslx/beamergui/beamer.conf"
@@ -67,7 +65,7 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
fi
# Either of them a projector?
- BEAMER=
+ B_INDEX=
MAYBEAMER=
SMALL=
TF=$(mktemp)
@@ -98,15 +96,15 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
fi
# Set beamer if any match
if [ -n "$FOUND" ]; then
- BEAMER=$i
+ B_INDEX=$i
continue
fi
fi
# Classic test by what X(randr) figured out
- WIDTH=$( <<<"$XRANDR" grep -E "^${OUTPUTNAMES[$i]}.*[0-9]+mm x [0-9]+mm" | head -n 1 | grep -o -E ' [0-9]+mm x' | grep -o -E '[0-9]+' )
+ WIDTH=$( <<<"$XRANDR" grep -m 1 -E "^${OUTPUTNAMES[$i]}.*[0-9]+mm x [0-9]+mm" | grep -o -E ' [0-9]+mm x' | grep -o -E '[0-9]+' )
if [ -z "$WIDTH" ] || [ "$WIDTH" -eq 0 ] || [ "$WIDTH" -gt 900 ]; then
echo "Screen $i is beamer, width is '$WIDTH'"
- BEAMER=$i
+ B_INDEX=$i
elif [ -n "$WIDTH" ] && [ "$WIDTH" -gt 700 ]; then
MAYBEAMER=$i
elif [ -n "$WIDTH" ] && [ "$WIDTH" -lt 550 ]; then
@@ -114,17 +112,20 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
fi
done
rm -f -- "$TF"
- if [ -z "$BEAMER" ] && [ -n "$MAYBEAMER" ] && [ -n "$SMALL" ]; then
+ if [ -z "$B_INDEX" ] && [ -n "$MAYBEAMER" ] && [ -n "$SMALL" ]; then
# This is a hack on top of the other hack; we already treat outputs reporting a sufficiently large width
# as beamers, as we have encountered such devices in the wild. However, we might have just a large TV connected
# that is intended to be used just like a beamer to present the screen to the audience. So if we have a screen
# that is at least 70cm wide and the other one is no wider than 55cm we treat this as a beamer setup aswell.
# The reasoning here is that if it were a dual screen setup, the screens should be roughly the same size.
echo "Treating $MAYBEAMER as beamer as size difference is big enough"
- BEAMER=$MAYBEAMER
+ B_INDEX=$MAYBEAMER
fi
- if [ -n "$BEAMER" ]; then
- echo "${OUTPUTNAMES[$BEAMER]} is a beamer. "
+ if [ -n "$B_INDEX" ]; then
+ BEAMER=${OUTPUTNAMES[$B_INDEX]}
+ OTHER=${OUTPUTNAMES[$(( 1 - B_INDEX ))]}
+
+ echo "$BEAMER is a beamer. "
# Create all modes, so that X knows them by name "<width>x<height>"
# Add the modes to the outputs, this means that, if this action is
@@ -150,24 +151,20 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
# Find out whether the beamer transmits reliable EDID data.
# The data in xrandr should be reliable if the EDID is present.
SUCCESS=
- if <<<"$XRANDRV" grep -Pzo \
- "\n${OUTPUTNAMES[$BEAMER]}\N*\n(\s+\N*\n)+" \
- | grep EDID > /dev/null ; then
- echo "${OUTPUTNAMES[$BEAMER]} [Beamer] provides EDID."
-
- # If the breamer transmits the EDID there shall be a preferred resolution.
- OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n${OUTPUTNAMES[$BEAMER]}\N*\n(\s+\N*\n)+" \
- | grep preferred | awk '{print $1}' )
+ # If the beamer transmits the EDID there shall be a preferred resolution.
+ OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n$BEAMER\N*\n(\s+\N*\n)+" | grep -m 1 -a preferred | awk '{print $1}' )
+ if [ -n "$OPTIMALRES" ] && <<<"$XRANDRV" grep -Pzo "\n$BEAMER\N*\n(\s+\N*\n)+" | grep -q EDID; then
+ echo "$BEAMER [Beamer] provides EDID, says $OPTIMALRES is optimal."
# (try to) make sure the display has the preferred mode of the beamer added to it, in case it wasn't in our list from above
- xrandr --current --addmode "${OUTPUTNAMES[$((1-$BEAMER))]}" "$OPTIMALRES"
+ xrandr --current --addmode "$OTHER" "$OPTIMALRES"
# Apply the optimal resolution tho either of the outputs. The beamer has
# to be the secondary output.
if xrandr \
- --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "$OPTIMALRES" \
+ --output "$OTHER" --mode "$OPTIMALRES" \
--primary \
- --output "${OUTPUTNAMES[$BEAMER]}" --mode "$OPTIMALRES" \
- --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}"
+ --output "$BEAMER" --mode "$OPTIMALRES" \
+ --same-as "$OTHER"
then
echo "Applied optimal resolution successfully."
SUCCESS=1
@@ -180,20 +177,20 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
# Get local ip
. /opt/openslx/config
- # Try to get a probed mode
- PROBEDMODE=$( <"$CONFIGFILE" grep "^\\s*${SLX_PXE_CLIENT_IP}" | cut -d '=' -f2 )
+ # Try to get a forced mode from config
+ FORCED_MODE=$( <"$CONFIGFILE" grep -m 1 "^\\s*${SLX_PXE_CLIENT_IP}\\s*=" | cut -d '=' -f2 )
- # If a probed mode was found, ..
- if [[ -n "$PROBEDMODE" ]]; then
- echo "Probed mode found in config file."
+ # If a mode was found, ..
+ if [[ -n "$FORCED_MODE" ]]; then
+ echo "Forced mode found in config file."
# Apply the probed mode from the config file
if xrandr \
- --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "$PROBEDMODE" \
+ --output "$OTHER" --mode "$FORCED_MODE" \
--primary \
- --output "${OUTPUTNAMES[$BEAMER]}" --mode "$PROBEDMODE" \
- --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}"
+ --output "$BEAMER" --mode "$FORCED_MODE" \
+ --same-as "$OTHER"
then
- echo "Applied probed mode successfully."
+ echo "Applied forced mode $FORCED_MODE successfully."
SUCCESS=1
fi
else
@@ -203,21 +200,21 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
if [ -z "$SUCCESS" ]; then
# Apply a fallback mode
# Maybe the screen has EDID, use its preferred resolution
- OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n${OUTPUTNAMES[$((1-$BEAMER))]}\N*\n(\s+\N*\n)+" \
- | grep preferred | awk '{print $1}' )
- for res in "$OPTIMALRES" "1280x768"; do
+ OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n$OTHER\N*\n(\s+\N*\n)+" \
+ | grep -m 1 -a preferred | awk '{print $1}' )
+ for res in "$OPTIMALRES" "1280x800" "1280x720"; do
[ -z "$res" ] && continue
echo -e "\e[31mERROR: Beamer provides no EDID and no config found in $CONFIGFILE. Falling back to ${OPTIMALRES}.\e[0m"
xrandr \
- --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "$res" \
+ --output "$OTHER" --mode "$res" \
--primary \
- --output "${OUTPUTNAMES[$BEAMER]}" --mode "$res" \
- --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}" && break
+ --output "$BEAMER" --mode "$res" \
+ --same-as "$OTHER" && break
done
fi
- else
+ else # $B_INDEX is empty
# In case of two monitors just sort the outputs lexicographically and apply
- # the preffered resolution
+ # the preferred resolution
echo "Dualhead setup deteced. Sorting outputs lexicographically."
readarray -t OUTPUTNAMES \
< <(for a in "${OUTPUTNAMES[@]}"; do echo "$a"; done | sort)
@@ -231,7 +228,10 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
echo "Successfully applied preferred modes on outputs in sorted order."
fi
fi
+
else
echo -e "\e[32mOther than two outputs.\e[0m"
fi
+exit 0
+
diff --git a/core/modules/beamergui/module.build b/core/modules/beamergui/module.build
index db1bc6a4..e47758cc 100644
--- a/core/modules/beamergui/module.build
+++ b/core/modules/beamergui/module.build
@@ -6,16 +6,11 @@ fetch_source() {
build() {
local SRCDIR="${MODULE_WORK_DIR}/src/"
- QMAKE="$(which qmake-qt5)"
- [ -z "$QMAKE" ] && QMAKE=qmake
-
- # first activate qt 5
- activate_qt 5
mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin"
cd "${MODULE_BUILD_DIR}/opt/openslx/bin" || perror "Could not cd!"
- pinfo "Running qmake"
- "$QMAKE" "$SRCDIR/src/beamergui.pro" -r -spec linux-g++ || perror "'$QMAKE' failed (e.g. not installed)."
+ pinfo "Running cmake"
+ cmake "$SRCDIR" || perror "'$QMAKE' failed (e.g. not installed)."
pinfo "Running make"
make || perror "'make' failed."