feat(menu): search options and applications from the main menu

The main menu opens with a search that finds an option of ProxMenux, an application of the OCI catalog or a Helper-Script by its name or by related words, in that order, and by category after the names.

Every result opens what its name says and nothing is run by the search itself: a script starts at its first screen, an application opens its page, an option of the post-install or a system utility opens its list with it marked, and an option that lives inside a menu is opened by that menu, which stays behind it.

The menus take the option to open as an argument and behave as before without one. The Helper-Scripts catalog is kept on the host and refreshed once a day. The main menu, the lists of OCI manager and the Helper-Scripts menu share the same height.
This commit is contained in:
MacRimi
2026-10-11 13:26:23 +02:00
parent 8b8fed2564
commit 0fd3be15c1
16 changed files with 1219 additions and 42 deletions
+21 -9
View File
@@ -288,6 +288,7 @@ show_menu() {
declare -A script_commands
local counter=1
local preselected=""
# Sprint 12C: re-evaluate available updates on every loop so the
# entry vanishes after the user has applied everything (and the
@@ -317,6 +318,7 @@ show_menu() {
formatted_item=$(format_menu_item "$translated_name" "$source")
menu_items+=("$counter" "$formatted_item")
script_commands["$counter"]="$command"
[[ -n "$PRESELECTED_OPTION" && "$name" == "$PRESELECTED_OPTION" ]] && preselected="$counter"
((counter++))
done
@@ -332,6 +334,7 @@ show_menu() {
formatted_item=$(format_menu_item "$translated_name" "$source")
menu_items+=("$counter" "$formatted_item")
script_commands["$counter"]="$command"
[[ -n "$PRESELECTED_OPTION" && "$name" == "$PRESELECTED_OPTION" ]] && preselected="$counter"
((counter++))
done
@@ -340,15 +343,23 @@ show_menu() {
menu_items+=("0" "$(translate "Return to Main Menu")")
exec 3>&1
script_selection=$(dialog --clear --colors \
--backtitle "ProxMenux" \
--title "$(translate "Post-Installation Scripts")" \
--menu "\n$(translate "Select a post-installation script:")\n" \
24 84 16 \
"${menu_items[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
# An option given as argument, as the menu search does, is opened
# first; the menu follows.
if [[ -n "$preselected" ]]; then
script_selection="$preselected"
exit_status=0
PRESELECTED_OPTION=""
else
exec 3>&1
script_selection=$(dialog --clear --colors \
--backtitle "ProxMenux" \
--title "$(translate "Post-Installation Scripts")" \
--menu "\n$(translate "Select a post-installation script:")\n" \
24 84 16 \
"${menu_items[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
fi
if [ $exit_status -ne 0 ] || [ "$script_selection" = "0" ]; then
@@ -372,4 +383,5 @@ show_menu() {
# ==========================================================
PRESELECTED_OPTION="${1:-}"
show_menu