| 1 |
|
| 2 |
function password { |
| 3 |
yad --no-markup --title "$title" --center --skip-taskbar --splash --text "$text" --button gtk-cancel:1 --button gtk-ok:0 --image dialog-password --entry --entry-label "$label" --entry-text "$init" --hide-text --completion --timeout $timeout --timeout-indicator bottom |
| 4 |
exit $? |
| 5 |
} |
| 6 |
|
| 7 |
function input { |
| 8 |
yad --no-markup --title "$title" --center --skip-taskbar --splash --text "$text" --button gtk-cancel:1 --button gtk-ok:0 --image dialog-question --entry --entry-label "$label" --entry-text "$init" --completion --timeout $timeout --timeout-indicator bottom |
| 9 |
exit $? |
| 10 |
} |
| 11 |
|
| 12 |
function confirm_default_no { |
| 13 |
yad --no-markup --title "$title" --center --skip-taskbar --splash --text "$text" --button gtk-no:1 --button gtk-yes:0 --image dialog-question --timeout $timeout --timeout-indicator bottom |
| 14 |
ret=$? |
| 15 |
if [ $ret == 0 ]; then |
| 16 |
echo "yes" |
| 17 |
fi |
| 18 |
exit $ret |
| 19 |
} |
| 20 |
|
| 21 |
function confirm_default_yes { |
| 22 |
yad --no-markup --title "$title" --center --skip-taskbar --splash --text "$text" --button gtk-yes:0 --button gtk-no:1 --image dialog-question --timeout $timeout --timeout-indicator bottom |
| 23 |
ret=$? |
| 24 |
if [ $ret == 0 ]; then |
| 25 |
echo "yes" |
| 26 |
fi |
| 27 |
exit $ret |
| 28 |
} |
| 29 |
|
| 30 |
function _select { |
| 31 |
h=$((125 + 22 * $#)) |
| 32 |
yad --no-markup --title "$title" --width 400 --height $h --center --skip-taskbar --splash --text "$text" --button gtk-cancel:1 --button gtk-ok:0 --timeout $timeout --timeout-indicator bottom --image dialog-question --list --separator "" --search-column 1 --regex-search --column "$label" "$init" "${@}" |
| 33 |
} |
| 34 |
|
| 35 |
function select2 { |
| 36 |
if [ "$type" == "select-other" ]; then |
| 37 |
out=$(_select ${@} "Other") |
| 38 |
else |
| 39 |
out=$(_select ${@}) |
| 40 |
fi |
| 41 |
ret=$? |
| 42 |
out=${out//\\n/} |
| 43 |
if [ $ret != 0 ]; then |
| 44 |
exit $ret |
| 45 |
fi |
| 46 |
if [ "$out" != "Other" ]; then |
| 47 |
echo $out |
| 48 |
exit $ret |
| 49 |
else |
| 50 |
text=${text//Select/Enter} |
| 51 |
text=${text//select/enter} |
| 52 |
input |
| 53 |
fi |
| 54 |
} |
| 55 |
|
| 56 |
function multiple { |
| 57 |
printf '%s\n' "${@}" | head -c -1 | yad --no-markup --title "$title" --width 400 --height 222 --center --skip-taskbar --splash --text "$text" --button gtk-cancel:1 --button gtk-ok:0 --timeout $timeout --timeout-indicator bottom --image dialog-question --label "$label" --text-info --editable | grep -v '^$' |
| 58 |
} |
| 59 |
|
| 60 |
function simple_link_QR { |
| 61 |
echo "$text" | yad --no-markup --title "$title" --width 600 --height 350 --center --skip-taskbar --splash --button gtk-ok:0 --image "$init" --wrap --show-uri --text-info --timeout $timeout --timeout-indicator bottom |
| 62 |
} |
| 63 |
|
| 64 |
function complex_link { |
| 65 |
# The option --wrap would be nice, but it wraps the long auth url really ugly |
| 66 |
# The option --show-uri would be nice (it makes uris clickable), but it doesn't work with query parameters. |
| 67 |
echo "$text" | yad --no-markup --title "$title" --width 800 --height 222 --center --skip-taskbar --splash --button gtk-ok:0 --text-info --timeout $timeout --timeout-indicator bottom |
| 68 |
} |