Search code examples
bashyad

When using Yad, can a button be made the default?


The title sets the question. If it can, what is the coding? Present coding is:- yad --center --on-top --text-align=center --buttons-layout=center --title ${0##*/} --width=150 --height=60 --text "Do you want tea?" --button=gtk-no:1 --button=gtk-yes:0 I want to make the yes button the default, so even if I just close the box the yes button is selected. Many thanks John


Solution

  • Found out that $? for Yes=0, for No=1 and Close=252, so coding externally allowed to make the Yes button the default. :-

    if [[ $? == 0 || $? == 252 ]]
    then
    echo "Default"
    else
    echo "No"
    fi