Add get function for VNC resolution

This commit is contained in:
Simon Long 2021-11-10 10:31:50 +00:00
parent be18975457
commit fde0346b60
1 changed files with 14 additions and 7 deletions

View File

@ -2094,11 +2094,18 @@ do_resolution() {
fi fi
} }
get_vnc_resolution() {
if [ -e /etc/xdg/autostart/vnc_xrandr.desktop ] ; then
echo $(grep fb /etc/xdg/autostart/vnc_xrandr.desktop | cut -f 15 -d ' ')
else
echo "not set"
fi
}
do_vnc_resolution() { do_vnc_resolution() {
if [ "$INTERACTIVE" = True ]; then if [ "$INTERACTIVE" = True ]; then
if [ -e /etc/xdg/autostart/vnc_xrandr.desktop ] ; then CUR=$(get_vnc_resolution)
CUR=$(grep fb /etc/xdg/autostart/vnc_xrandr.desktop | cut -f 15 -d ' ') if [ "$CUR" = "not set" ] ; then
else
CUR=640x480 CUR=640x480
fi fi
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --default-item $CUR --menu "Set VNC Resolution" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --default-item $CUR --menu "Set VNC Resolution" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
@ -2119,10 +2126,10 @@ Comment=Set resolution for VNC
NoDisplay=true NoDisplay=true
Exec=sh -c "if ! (xrandr | grep -q -w connected) ; then /usr/bin/xrandr --fb $FUN ; fi" Exec=sh -c "if ! (xrandr | grep -q -w connected) ; then /usr/bin/xrandr --fb $FUN ; fi"
EOF EOF
fi if [ "$INTERACTIVE" = True ]; then
if [ "$INTERACTIVE" = True ]; then whiptail --msgbox "The resolution is set to $FUN" 20 60 1
whiptail --msgbox "The resolution is set to $FUN" 20 60 1 ASK_TO_REBOOT=1
ASK_TO_REBOOT=1 fi
fi fi
} }