From 385ade20be6da4dccae6e8408411222cc0348340 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Thu, 24 Feb 2022 15:55:44 +0000 Subject: [PATCH] Tweaks to arguments and return values for overscan settings; always do a real-time update --- raspi-config | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/raspi-config b/raspi-config index 1449660..00c5d2a 100755 --- a/raspi-config +++ b/raspi-config @@ -331,16 +331,18 @@ do_overscan() { get_overscan_kms() { RES=$(grep "HDMI-$1" /usr/share/dispsetup.sh | grep margin | rev | cut -d ' ' -f 1 | rev) if [ -z $RES ] ; then - echo 0 + echo 1 + elif [ $RES -eq 0 ] ; then + echo 1 else - echo $RES + echo 0 fi } do_overscan_kms() { if [ "$INTERACTIVE" = True ]; then DEV=$(whiptail --menu "Select the output for which overscan is to be set" 20 60 10 "1" "HDMI-1" "2" "HDMI-2" 3>&1 1>&2 2>&3) - if [ $(get_overscan_kms $DEV) -eq 0 ]; then + if [ $(get_overscan_kms $DEV) -eq 1 ]; then DEFAULT=--defaultno else DEFAULT= @@ -354,8 +356,13 @@ do_overscan_kms() { fi else DEV=$1 - PIX=$2 + if [ $2 -eq 1 ] ; then + PIX=0 + else + PIX=16 + fi fi + xrandr --output HDMI-$DEV --set "left margin" $PIX --set "right margin" $PIX --set "top margin" $PIX --set "bottom margin" $PIX sed $CONFIG -i -e "s/^overscan_/#overscan_/" set_config_var disable_overscan 1 $CONFIG if grep "HDMI-$DEV" /usr/share/dispsetup.sh | grep -q margin ; then @@ -364,7 +371,6 @@ do_overscan_kms() { sed /usr/share/dispsetup.sh -i -e "s/exit/xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX\nexit/" fi if [ "$INTERACTIVE" = True ]; then - xrandr --output HDMI-$DEV --set "left margin" $PIX --set "right margin" $PIX --set "top margin" $PIX --set "bottom margin" $PIX whiptail --msgbox "Display overscan compensation for HDMI-$DEV is $STATUS" 20 60 1 fi }