mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
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:
@@ -3812,6 +3812,7 @@ main_menu() {
|
||||
|
||||
local checklist_items=()
|
||||
local i=1
|
||||
local preselected_item=""
|
||||
local desc_index=0
|
||||
local previous_category=""
|
||||
|
||||
@@ -3830,7 +3831,12 @@ main_menu() {
|
||||
local line
|
||||
line="$(format_custom_post_line "$desc_translated" "$category_translated")"
|
||||
|
||||
checklist_items+=("$i" "$line" "off")
|
||||
local state="off"
|
||||
if [[ -n "${PRESELECTED_OPTION:-}" && "$function_name" == "$PRESELECTED_OPTION" ]]; then
|
||||
state="on"
|
||||
preselected_item="$i"
|
||||
fi
|
||||
checklist_items+=("$i" "$line" "$state")
|
||||
i=$((i + 1))
|
||||
previous_category="$category"
|
||||
done
|
||||
@@ -3839,6 +3845,7 @@ main_menu() {
|
||||
selected_indices=$(dialog --clear \
|
||||
--backtitle "ProxMenux" \
|
||||
--title "$(translate "Post-Installation Options")" \
|
||||
--default-item "${preselected_item:-1}" \
|
||||
--checklist "$HEADER" 22 88 15 \
|
||||
"${checklist_items[@]}" \
|
||||
2>&1 1>&3)
|
||||
@@ -3967,6 +3974,8 @@ done
|
||||
# update wrapper that re-runs a single function), don't trigger the
|
||||
# extremeshok warning or the main menu.
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
# An option given as argument, as the menu search does, comes selected.
|
||||
PRESELECTED_OPTION="${1:-}"
|
||||
check_extremeshok_warning
|
||||
main_menu
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user