From 1451c8f90cab6a28216872f017083a77dad54be1 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Thu, 15 Jan 2026 01:46:51 -0500 Subject: Adding python based tui to replace whiptail On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: scripts/copy_menu.sh new file: scripts/tui_menu.py --- scripts/copy_menu.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'scripts/copy_menu.sh') diff --git a/scripts/copy_menu.sh b/scripts/copy_menu.sh index 78fb4070..212cab84 100755 --- a/scripts/copy_menu.sh +++ b/scripts/copy_menu.sh @@ -20,12 +20,24 @@ show_copy_menu() { local express_desc="Skips restores & wallpapers" local update_desc="Stash + git pull" local quit_desc="Exit without changes" - if [ "$express_supported" -ne 1 ]; then - express_body="xpress - Requires dots >= ${MIN_EXPRESS_VERSION}" - fi local choice="" + # Prefer Python TUI if available (mouse + keyboard, styled hotkeys, help) + # Determine repo dir robustly: prefer SCRIPT_DIR if set by caller (copy.sh); fallback to this file's parent + local __self_dir __repo_dir + __self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + __repo_dir="${SCRIPT_DIR:-$(cd "${__self_dir}/.." 2>/dev/null && pwd)}" + local py_menu="${__repo_dir}/scripts/tui_menu.py" + if command -v python3 >/dev/null 2>&1 && [ -f "$py_menu" ]; then + if choice=$(python3 "$py_menu" --express-supported "$express_supported"); then + # shellcheck disable=SC2034 # used by parent script after sourcing this file + COPY_MENU_CHOICE="$choice" + return 0 + fi + fi + + # Fallback to whiptail if present if command -v whiptail >/dev/null 2>&1; then if ! choice=$(whiptail --title "$menu_title" --menu "$prompt" 17 60 8 \ "$install_tag" "$install_desc" \ @@ -37,6 +49,7 @@ show_copy_menu() { return 1 fi else + # Plain-text fallback while true; do printf "\n%s\n" "$menu_title" printf "%s\n" "$prompt" -- cgit v1.2.3