Search code examples
bashzenity

How to confirm an input using Zenity?


I need to display a GUI pop up that shows a message with a variable, and allows user to confirm or cancel.

Perhaps I'm missing something, but I could not find any documentation on Zenity --questions tag. So far I couldn't get anything other than default question to display.

I don't want to use Yad if possible... I would like to stick with Zenity.

Is there any way to do this with Zenity?

Example:

var="ABC"
msg="Confirm $var"
zenity --text-info \
    --title="Confirm"
    --text="$msg"
    # --question "This is the question"
case $? in
    0)
        return
    ;;
    1)
        return
    ;;
esac

Solution

  • zenity --question --title="Confirm" --text="$msg"
    

    It's --question, not --questions, but in the Zenity manual, do a Ctrl-F for question to find all the relevant sections.