diff --git a/.includes/dialog-interface.sh b/.includes/dialog-interface.sh index 210d9da..6bd08ca 100644 --- a/.includes/dialog-interface.sh +++ b/.includes/dialog-interface.sh @@ -26,22 +26,19 @@ agm_menu() { shift 3 if [[ "$dialogType" == "yad" ]]; then - # Build yad list format: Display only, then map back to value - local yadList="" + # Pass rows as arguments so Yad selects the first row on opening. + local yadRows=() declare -A valueMap while [[ $# -gt 0 ]]; do local option="$1" local description="$2" valueMap["$description"]="$option" - if [[ -n "$yadList" ]]; then - yadList="$yadList\n" - fi - yadList="${yadList}${description}" + yadRows+=("$description") shift 2 done local selectedDescription - selectedDescription=$(echo -e "$yadList" | yad --list \ + selectedDescription=$(yad --list \ --title="$title" \ --text="$text" \ --column="Option" \ @@ -49,7 +46,7 @@ agm_menu() { --selectable-labels \ --search-column=1 \ --height=400 \ - --width=600) || return $? + --width=600 "${yadRows[@]}"