#!/usr/bin/env bash # terminals.sh — Terminal emulators _cat_terminals() { local headless=false _is_headless && headless=true if $headless; then echo "Terminals require a GUI — skipping." return fi local -a items=() for t in kitty deepin-terminal gnome-terminal lxterminal mate-terminal \ qterminal xfce4-terminal konsole terminator guake cool-retro-term \ tilix yakuake terminology rxvt-unicode xterm; do items+=("$t" "" "$(_state "$t")") done if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then items+=("alacritty" "" "$(_state alacritty)") items+=("zutty" "" "$(_state zutty)") fi if [ "$DEBIAN_VERSION" = "13" ]; then items+=("blackbox-terminal" "" "$(_state blackbox-terminal)") items+=("ptyxis" "" "$(_state ptyxis)") fi local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices choices=$(_checklist "Terminals" "Check [*] the packages you want installed/updated on your system.\n" \ $TUI_ALTO $TUI_ANCHO $lista_alto "${items[@]}") clear [ -z "$choices" ] && return # BH-004: Convert to array to avoid word splitting and injection. local -a _pkgs=() while IFS= read -r _pkg; do [ -n "$_pkg" ] && _pkgs+=("$_pkg") done < <(echo "$choices" | tr -d '"' | tr ' ' '\n') # Pre-apply summary: confirm the selection once, # before any apt transaction starts. _confirm_install_list "Terminals" "${_pkgs[@]}" || return for pkg in "${_pkgs[@]}"; do if ! is_installed "$pkg"; then _run_install "$pkg" else echo "$pkg already installed." fi done # Release the per-package prompt suppression. _SELECTION_CONFIRMED=0 echo -e "${GREEN}Terminals installed.${NC}" }