3

I know that I can change the progress of a whiptail --gauge using something like:

{
    for ((i = 0 ; i <= 100 ; i+=20)); do
        sleep 1
        echo $i
    done
} | whiptail --gauge "Please wait while installing" 6 60 0

But I am wondering whether it is possible to edit/modify the text of the whiptail box (so change the Please wait while installing text to something else.

My current solution is to bring up a new whiptail box, but there is a noticeable flicker between the old one closing and the new one opening. If you can't update the text of a whiptail box, is it possible to reduce/remove this flicker instead?

5

Try this:

#!/bin/bash

msgs=( "Downloading" "Verifying" "Unpacking" "Almost Done" "Done" )

for i in {1..5}; do
  sleep 1
  echo XXX
  echo $(( i * 20 ))
  echo ${msgs[i-1]}
  echo XXX
done |whiptail --gauge "Please wait while installing" 6 60 0
  • Geez, how did I miss that? – Runium Jun 1 '16 at 22:18
1

The flicker comes from (a) switching to/from the alternate/normal screens in the terminal and (b) from clearing the display.

You can eliminate the first part by choosing a terminal description lacking the control sequences used for switching between normal/alternate screens. Usually those are the smcup and rmcup capabilities in the terminal description, so...

infocmp >foo
vi
...remove the assignments to `rmcup` and `smcup`
tic foo
...with ncurses, that likely creates an entry in `$HOME/.terminfo`

dialog handles this by optionally suppressing those capabilities (i.e., --keep-tite); whiptail doesn't know anything about the alternate screen.

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.