Tweaks to arguments and return values for overscan settings; always do a real-time update

This commit is contained in:
Simon Long 2022-02-24 15:55:44 +00:00
parent a679096c43
commit 385ade20be

View File

@ -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
}