Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cee5e4d58a |
@@ -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[@]}" </dev/null) || return $?
|
||||
|
||||
# Strip trailing pipes and return the mapped value
|
||||
if [[ -n "$selectedDescription" ]]; then
|
||||
@@ -94,21 +91,19 @@ agm_game_menu() {
|
||||
|
||||
if [[ "$dialogType" == "yad" ]]; then
|
||||
# Use custom buttons to match dialog behavior.
|
||||
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" \
|
||||
@@ -120,7 +115,7 @@ agm_game_menu() {
|
||||
--button="Launch:0" \
|
||||
--button="Read Documentation:2" \
|
||||
--button="Desktop Shortcut:4" \
|
||||
--button="Cancel:1")
|
||||
--button="Cancel:1" "${yadRows[@]}" </dev/null)
|
||||
local menuCode=$?
|
||||
|
||||
# Strip trailing pipes and return the mapped value
|
||||
|
||||
Reference in new issue
Block a user