From f3476385ac202578df12637792d8dc3022685395 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Sun, 6 Oct 2024 10:43:09 -0500 Subject: [PATCH] 118 task show menu location in the title box (#121) * Update config.ng.functions.sh * added sumenu to title * fix: typo * added breadcrumbs to menu * moved Breadcrumbs to title, ,revert json * revert json --------- Co-authored-by: Tearran --- lib/armbian-configng/config.ng.functions.sh | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/armbian-configng/config.ng.functions.sh b/lib/armbian-configng/config.ng.functions.sh index 5b49905f..79f67acb 100644 --- a/lib/armbian-configng/config.ng.functions.sh +++ b/lib/armbian-configng/config.ng.functions.sh @@ -228,7 +228,7 @@ function set_runtime_variables() { [[ -z "${ARMBIAN// /}" ]] && ARMBIAN="$DISTRO $DISTROID" DEFAULT_ADAPTER=$(ip -4 route ls | grep default | tail -1 | grep -Po '(?<=dev )(\S+)') LOCALIPADD=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) - BACKTITLE="\n Contribute: https://github.com/armbian/configng\n" + BACKTITLE="Contribute: https://github.com/armbian/configng" TITLE="Armbian configuration utility" [[ -z "${DEFAULT_ADAPTER// /}" ]] && DEFAULT_ADAPTER="lo" @@ -528,14 +528,17 @@ module_options+=( # Function to generate the main menu from a JSON object # generate_top_menu() { - local json_data=$1 + local json_data="$1" + local status="$ARMBIAN $KERNELID ($DISTRO $DISTROID)" + local backtitle="$BACKTITLE" + while true; do local menu_options=() parse_menu_items menu_options - local OPTION=$($DIALOG --title "$TITLE" --menu "$BACKTITLE" 0 80 9 "${menu_options[@]}" \ + local OPTION=$($DIALOG --backtitle "$backtitle" --title "$TITLE" --menu "$status" 0 80 9 "${menu_options[@]}" \ --ok-button Select --cancel-button Exit 3>&1 1>&2 2>&3) local exitstatus=$? @@ -548,7 +551,7 @@ generate_top_menu() { } module_options+=( - ["generate_menu,author"]="Joey Turner" + ["generate_menu,author"]="Tearran" ["generate_menu,ref_link"]="" ["generate_menu,feature"]="generate_menu" ["generate_menu,desc"]="Generate a submenu from a parent_id" @@ -560,14 +563,17 @@ module_options+=( # Function to generate the submenu # function generate_menu() { - local parent_id=$1 + local parent_id="$1" + local top_parent_id="$2" + local backtitle="$BACKTITLE" + local status="" while true; do # Get the submenu options for the current parent_id local submenu_options=() parse_menu_items submenu_options - local OPTION=$($DIALOG --title "$TITLE" --menu "$BACKTITLE" 0 80 9 "${submenu_options[@]}" \ + local OPTION=$($DIALOG --backtitle "$BACKTITLE" --title "$top_parent_id $parent_id" --menu "$status" 0 80 9 "${submenu_options[@]}" \ --ok-button Select --cancel-button Back 3>&1 1>&2 2>&3) local exitstatus=$? @@ -581,7 +587,7 @@ function generate_menu() { if [ "$submenu_count" -gt 0 ]; then # If it does, generate a new menu for the submenu [[ -n "$debug" ]] && echo "$OPTION" - generate_menu "$OPTION" + generate_menu "$OPTION" "$parent_id" else # If it doesn't, execute the command [[ -n "$debug" ]] && echo "$OPTION" @@ -722,7 +728,7 @@ show_menu() { done <<< "$input" # Display the menu and get the user's choice - [[ $DIALOG != "bash" ]] && choice=$($DIALOG --title "Menu" --menu "Choose an option:" 0 0 9 "${options[@]}" 3>&1 1>&2 2>&3) + [[ $DIALOG != "bash" ]] && choice=$($DIALOG --title "$TITLE" --menu "Choose an option:" 0 0 9 "${options[@]}" 3>&1 1>&2 2>&3) # Check if the user made a choice if [ $? -eq 0 ]; then