Merge pull request #860 from brontide/screen_detection

Screen detection, sane minimums for whiptail dailogs
This commit is contained in:
Dan Schaper 2016-10-26 11:06:43 -07:00 committed by GitHub
commit 7c89b6934a

View file

@ -32,13 +32,17 @@ useUpdateVars=false
IPv4_address="" IPv4_address=""
IPv6_address="" IPv6_address=""
# Find the rows and columns # Find the rows and columns will default to 80x24 is it can not be detected
rows=$(tput lines) screen_size=$(stty size 2>/dev/null || echo 24 80)
columns=$(tput cols) rows=$(echo $screen_size | awk '{print $1}')
columns=$(echo $screen_size | awk '{print $2}')
# Divide by two so the dialogs take up half of the screen, which looks nice. # Divide by two so the dialogs take up half of the screen, which looks nice.
r=$(( rows / 2 )) r=$(( rows / 2 ))
c=$(( columns / 2 )) c=$(( columns / 2 ))
# Unless the screen is tiny
r=$(( r < 20 ? 20 : r ))
c=$(( c < 70 ? 70 : c ))
######## Undocumented Flags. Shhh ######## ######## Undocumented Flags. Shhh ########
skipSpaceCheck=false skipSpaceCheck=false