Search Mabox Forum From CLI

Search the Mabox, Manjaro and Endevouros Forum.

With this very simple script it is possible to,
not only search the Mabox forum from terminal,
but also Manjaro and EndevourOs are searched.

search-mabox-forum.sh

#!/bin/bash
# ─── Forum Search Tool ───────────────────────────────────────────────

clear 

# ─── User configuration ─────────────────────────────
DEFAULT_HITS=10   # ← set here how many results per search to show

# Forums to search
FORUMS=(
    "EndeavourOS|https://forum.endeavouros.com"
    "Manjaro|https://forum.manjaro.org"
    "Mabox|https://forum.maboxlinux.org"
)

# ─── Dependency checks ──────────────────────────────────────────────
MISSING=false
for dep in curl jq notify-send; do
  if ! command -v "$dep" &>/dev/null; then
    echo "Missing dependency: $dep"
    MISSING=true
  fi
done
if [ "$MISSING" = true ]; then
  echo "Please install missing dependencies and re-run."
  exit 1
fi

# Directories & files
CACHE_DIR="$HOME/.cache/mabox_forum"
mkdir -p "$CACHE_DIR"
BOOKMARK_FILE="$CACHE_DIR/bookmarks.log"
HISTORY_FILE="$CACHE_DIR/history.log"

# ─── Colors ────────────────────────────────────────────────────────
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2)
CYAN=$(tput setaf 6)
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
WHITE=$(tput setaf 7)
ORANGE=$(tput setaf 208)

# Forum → color mapping
forum_color() {
  case "$1" in
    EndeavourOS) echo "$CYAN" ;;
    Manjaro) echo "$GREEN" ;;
    Mabox) echo "$YELLOW" ;;
    *) echo "$WHITE" ;;
  esac
}

# ─── Icons ─────────────────────────────────────────────────────────
ICON_SEARCH=$'\uf002'
ICON_BOOKMARK=$'\uf02e'
ICON_LINK=$'\uf0c1'
ICON_CHECK=$'\uf00c'
ICON_INFO=$'\uf05a'
ICON_EXIT=$'\uf00d'

# ─── Globals ──────────────────────────────────────────────────────
RESULT_TITLES=()
RESULT_LINKS=()
RESULT_FORUMS=()
idx=0

# ─── Language ─────────────────────────────────────────────
case "${LANG:0:2}" in
  es)
    TXT_SUPPORTED="<b>Foros soportados:</b> EndeavourOS - Manjaro - Mabox"
    TXT_SEARCH="<b>Búsqueda</b>\n • Escribe palabras clave → buscar en foros"
    TXT_BOOKMARKS="<b>Marcadores</b>\n • <tt>!l|!L</tt> → listar marcadores\n • <tt>!b|!B N [N...]</tt> → añadir marcador(es)\n • <tt>!d|!D N [N...120 80 33 12 5 2]</tt> → eliminar marcador(es)"
    TXT_NAV="<b>Navegación</b>\n • <tt>!c|!C</tt> → limpiar resultados\n • <tt>!h|!H</tt> → mostrar ayuda\n • Ctrl+C → salir"
    TXT_HEADER="${GREEN}${BOLD}HERRAMIENTA DE BÚSQUEDA EN FOROS${NORMAL}"
    TXT_COMMAND_HINT="${CYAN}Escribe !h|!H para ver los comandos.${NORMAL}"
    TXT_PROMPT="${CYAN}${ICON_SEARCH} Palabras clave o comando: ${NORMAL}"
    TXT_FETCHING="${CYAN}Obteniendo resultados para: '${NORMAL}%s${CYAN}'...${NORMAL}"
    TXT_NO_RESULTS="${YELLOW}${ICON_INFO} Sin resultados.${NORMAL}"
    TXT_BOOKMARK_ADDED="${GREEN}${ICON_CHECK} Marcador añadido:${NORMAL} %s"
    TXT_BOOKMARK_INVALID="${RED}${ICON_INFO} Número de marcador inválido: %s${NORMAL}"
    TXT_BOOKMARK_DELETED="${GREEN}${ICON_CHECK} Marcador #%s eliminado.${NORMAL}"
    TXT_ERROR_FETCH="${RED}${ICON_INFO} %s: Error al obtener datos.${NORMAL}"
    TXT_TITLE="Ayuda de búsqueda en foros"
    ;;
  pl)
    TXT_SUPPORTED="<b>Obsługiwane fora:</b> EndeavourOS - Manjaro - Mabox"
    TXT_SEARCH="<b>Szukaj</b>\n • Wpisz słowa kluczowe → szukaj na forach"
    TXT_BOOKMARKS="<b>Zakładki</b>\n • <tt>!l|!L</tt> → lista zakładek\n • <tt>!b|!B N [N...]</tt> → dodaj zakładkę(i)\n • <tt>!d|!D N [N...120 80 33 12 5 2]</tt> → usuń zakładkę(i)"
    TXT_NAV="<b>Nawigacja</b>\n • <tt>!c|!C</tt> → wyczyść wyniki\n • <tt>!h|!H</tt> → pokaż pomoc\n • Ctrl+C → wyjście"
    TXT_HEADER="${GREEN}${BOLD}NARZĘDZIE WYSZUKIWANIA NA FORACH${NORMAL}"
    TXT_COMMAND_HINT="${CYAN}Wpisz !h|!H aby zobaczyć komendy.${NORMAL}"
    TXT_PROMPT="${CYAN}${ICON_SEARCH} Słowa kluczowe lub komenda: ${NORMAL}"
    TXT_FETCHING="${CYAN}Pobieranie wyników dla: '${NORMAL}%s${CYAN}'...${NORMAL}"
    TXT_NO_RESULTS="${YELLOW}${ICON_INFO} Brak wyników.${NORMAL}"
    TXT_BOOKMARK_ADDED="${GREEN}${ICON_CHECK} Dodano zakładkę:${NORMAL} %s"
    TXT_BOOKMARK_INVALID="${RED}${ICON_INFO} Nieprawidłowy numer zakładki: %s${NORMAL}"
    TXT_BOOKMARK_DELETED="${GREEN}${ICON_CHECK} Zakładka #%s usunięta.${NORMAL}"
    TXT_ERROR_FETCH="${RED}${ICON_INFO} %s: Błąd pobierania danych.${NORMAL}"
    TXT_TITLE="Pomoc wyszukiwania na forum"
    ;;
  nl)
    TXT_SUPPORTED="<b>Ondersteunde forums:</b> EndeavourOS - Manjaro - Mabox"
    TXT_SEARCH="<b>Zoeken</b>\n • Typ trefwoorden → zoek forums"
    TXT_BOOKMARKS="<b>Bladwijzers</b>\n • <tt>!l|!L</tt> → lijst bladwijzers\n • <tt>!b|!B N [N...]</tt> → voeg bladwijzer(s) toe\n • <tt>!d|!D N [N...120 80 33 12 5 2]</tt> → verwijder bladwijzer(s)"
    TXT_NAV="<b>Navigatie</b>\n • <tt>!c|!C</tt> → verwijder resultaten\n • <tt>!h|!H</tt> → toon help\n • Ctrl+C → afsluiten"
    TXT_HEADER="${GREEN}${BOLD}FORUM ZOEK TOOL${NORMAL}"
    TXT_COMMAND_HINT="${CYAN}Typ !h|!H om de commando's te zien.${NORMAL}"
    TXT_PROMPT="${CYAN}${ICON_SEARCH} Zoekwoorden of commando: ${NORMAL}"
    TXT_FETCHING="${CYAN}Resultaten ophalen voor: '${NORMAL}%s${CYAN}'...${NORMAL}"
    TXT_NO_RESULTS="${YELLOW}${ICON_INFO} Geen resultaten.${NORMAL}"
    TXT_BOOKMARK_ADDED="${GREEN}${ICON_CHECK} Bladwijzer toegevoegd:${NORMAL} %s"
    TXT_BOOKMARK_INVALID="${RED}${ICON_INFO} Ongeldig bladwijzer nummer: %s${NORMAL}"
    TXT_BOOKMARK_DELETED="${GREEN}${ICON_CHECK} Bladwijzer #%s verwijderd.${NORMAL}"
    TXT_ERROR_FETCH="${RED}${ICON_INFO} %s: Fout bij ophalen gegevens.${NORMAL}"
    TXT_TITLE="Forum Zoek Hulp"
    ;;
  *)
    TXT_SUPPORTED="<b>Supported Forums:</b> EndeavourOS - Manjaro - Mabox"
    TXT_SEARCH="<b>Search</b>\n • Type keywords → search forums"
    TXT_BOOKMARKS="<b>Bookmarks</b>\n • <tt>!l|!L</tt> → list bookmarks\n • <tt>!b|!B N [N...]</tt> → add bookmark(s)\n • <tt>!d|!D N [N...120 80 33 12 5 2]</tt> → delete bookmark(s)"
    TXT_NAV="<b>Navigation</b>\n • <tt>!c|!C</tt> → clear hits\n • <tt>!h|!H</tt> → show help\n • Ctrl+C → quit"
    TXT_HEADER="${GREEN}${BOLD}FORUM SEARCH TOOL${NORMAL}"
    TXT_COMMAND_HINT="${CYAN}Type !h|!H to view commands.${NORMAL}"
    TXT_PROMPT="${CYAN}${ICON_SEARCH} Keywords or command: ${NORMAL}"
    TXT_FETCHING="${CYAN}Fetching results for: '${NORMAL}%s${CYAN}'...${NORMAL}"
    TXT_NO_RESULTS="${YELLOW}${ICON_INFO} No results.${NORMAL}"
    TXT_BOOKMARK_ADDED="${GREEN}${ICON_CHECK} Added bookmark:${NORMAL} %s"
    TXT_BOOKMARK_INVALID="${RED}${ICON_INFO} Invalid bookmark number: %s${NORMAL}"
    TXT_BOOKMARK_DELETED="${GREEN}${ICON_CHECK} Bookmark #%s deleted.${NORMAL}"
    TXT_ERROR_FETCH="${RED}${ICON_INFO} %s: Error fetching data.${NORMAL}"
    TXT_TITLE="Forum Search Help"
    ;;
esac

# ─── Function to show help ─────────────────────────────
notify_help() {
  local text="${TXT_SUPPORTED}\n\n🔹 ${TXT_SEARCH}\n\n🔹 ${TXT_BOOKMARKS}\n\n🔹 ${TXT_NAV}"

  yad --title="$TXT_TITLE" \
      --fixed --width=400 --height=250 \
      --window-icon="search" \
      --center \
      --button=Close:0 \
      --borders=10 \
      --no-wrap \
      --text="$text" \
      --fontname="Monospace 10" &
}

show_header() {
    clear
  echo -e "${BOLD}${GREEN}
███╗   ███╗ █████╗ ██████╗  ██████╗ ██╗  ██╗
████╗ ████║██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝
██╔████╔██║███████║██████╔╝██║   ██║ ╚███╔╝
██║╚██╔╝██║██╔══██║██╔══██╗██║   ██║ ██╔██╗
██║ ╚═╝ ██║██║  ██║██████╔╝╚██████╔╝██╔╝ ██╗
╚═╝     ╚═╝╚═╝  ╚═╝╚═════╝  ╚═════╝ ╚═╝  ╚═╝
${NORMAL}"
  echo -e "${TXT_HEADER}\n"
  echo -e "${YELLOW}${BOLD}Mabox | Manjaro | EndeavourOS${NORMAL}\n"
  echo -e "${TXT_COMMAND_HINT}\n"
}

bookmark_link() {
  local forum="$1" title="$2" link="$3"
  mkdir -p "$(dirname "$BOOKMARK_FILE")"
  echo "[$forum] $title - $link" >> "$BOOKMARK_FILE"
  printf "${TXT_BOOKMARK_ADDED}\n" "$title"
}

delete_bookmark() {
  local num="$1"
  if [[ ! -f "$BOOKMARK_FILE" || ! -s "$BOOKMARK_FILE" ]]; then
    echo -e "${TXT_NO_RESULTS}"
    return
  fi
  total=$(wc -l < "$BOOKMARK_FILE")
  if (( num < 1 || num > total )); then
    printf "${TXT_BOOKMARK_INVALID}\n" "$num"
    return
  fi
  sed -i "${num}d" "$BOOKMARK_FILE"
  printf "${TXT_BOOKMARK_DELETED}\n" "$num"
}

display_results() {
  for i in "${!RESULT_TITLES[@]}"; do
    forum="${RESULT_FORUMS[$i]}"
    color=$(forum_color "$forum")
    echo -e "${WHITE}$i.${NORMAL} [${color}${forum}${NORMAL}] ${BOLD}${ORANGE}${RESULT_TITLES[$i]}${NORMAL}"
    echo -e "   ${WHITE}${ICON_LINK} ${RESULT_LINKS[$i]}${NORMAL}"
  done
}

list_bookmarks() {
  if [[ -f "$BOOKMARK_FILE" && -s "$BOOKMARK_FILE" ]]; then
    nl -w2 -s". " "$BOOKMARK_FILE"
  else
    echo -e "${TXT_NO_RESULTS}"
  fi
}

# ─── Trap Exit ──────────────────────────────────────────────────────
trap 'echo -e "\n${RED}${ICON_EXIT} Exiting...${NORMAL}"; tput cnorm; exit' SIGINT
tput civis

# ─── Start ─────────────────────────────────────────────────────────
show_header

# ─── Main Loop ──────────────────────────────────────────────────────
while true; do
  read -rp "${TXT_PROMPT}" input
  [[ -n "$input" ]] || continue

  case "$input" in
    "!c"|"!C"|"!clear") show_header; continue ;;
    "!help"|"!h"|"!H") notify_help; continue ;;
    "!l"|"!L"|"!list") list_bookmarks; continue ;;
    "!b "*|"!B "*)
      nums=($(echo "$input" | sed -E 's/^![bB][[:space:]]+//'))
      for num in "${nums[@]}"; do
          num="${num//[^0-9]/}"
          if [[ -n "${RESULT_LINKS[$num]}" ]]; then
              bookmark_link "${RESULT_FORUMS[$num]}" "${RESULT_TITLES[$num]}" "${RESULT_LINKS[$num]}"
          else
              printf "${TXT_BOOKMARK_INVALID}\n" "$num"
          fi
      done
      continue ;;
    "!d "*|"!D "*)
      nums=($(echo "$input" | sed -E 's/^![dD][[:space:]]+//'))
      for num in "${nums[@]}"; do
          num="${num//[^0-9]/}"
          delete_bookmark "$num"
      done
      continue ;;
  esac

  # ─── Perform search ──────────────────────────────────────────────
  search_terms="$input"
  echo "$(date '+%F %T') - $search_terms" >> "$HISTORY_FILE"
  encoded_keyword=$(echo "$search_terms" | sed 's/ /+/g')

  printf "${TXT_FETCHING}\n" "$search_terms"

  RESULT_TITLES=()
  RESULT_LINKS=()
  RESULT_FORUMS=()
  idx=0

  for entry in "${FORUMS[@]}"; do
    NAME="${entry%%|*}"
    URL="${entry##*|}"
    SEARCH_URL="$URL/search.json"

    response=$(curl -s "${SEARCH_URL}?q=${encoded_keyword}")
    if [[ -z "$response" || "$response" == "null" ]]; then
      printf "${TXT_ERROR_FETCH}\n" "$NAME"
      continue
    fi

    hits=$(echo "$response" | jq '.topics | length')
    echo -e "\n${CYAN}${ICON_SEARCH} ${BOLD}$NAME forum ($hits results):${NORMAL}"
    if (( hits == 0 )); then
      echo -e "${TXT_NO_RESULTS}"
      continue
    fi

    while IFS=$'\t' read -r title link; do
      ((idx++))
      RESULT_FORUMS[$idx]="$NAME"
      RESULT_TITLES[$idx]="$title"
      RESULT_LINKS[$idx]="$link"
      echo -e "${WHITE}$idx.${NORMAL} [$(forum_color "$NAME")${NAME}${NORMAL}] ${BOLD}${ORANGE}${title}${NORMAL}"
      echo -e "   ${WHITE}${ICON_LINK} ${link}${NORMAL}"
    done < <(echo "$response" | jq -r --arg BASE "$URL" '
      .topics[] | {title: .title, link: ($BASE + "/t/" + .slug + "/" + (.id|tostring))} |
      [.title, .link] | @tsv
    ')
  done
done


How to search the forums …

:small_blue_diamond: Search
• Type keywords → search forums

:small_blue_diamond: Bookmarks
• !l | !L → list bookmarks !BS
• !b | !B N [N…] → add bookmark(s) !B
• !d | !D N [N…] → delete bookmark(s) !D

:small_blue_diamond: Navigation
• !c | !C → show menu !M
• !h | !H → show help !H
• Ctrl+C → quit"

Edit: last updated 11-march-2026

ps: the previews have old help structure.

:bird:

2 Likes

UPDATE:

  • added history search
  • and better search handling
  • update preview
$ search-mabox-forum.sh --history

:bird:

1 Like

Update: See Usage…

:bird:

1 Like

It looks great.
When I see these scripts, I always wonder where to save them.
Is it a good idea to have a folder like “My Scripts” for everything that isn’t part of the system itself?
If so, is it better to save it directly in /home or as a subfolder somewhere else?

New update: Non functional parts. Fine tune messages with MABOX ascii.

Just put it in ~/bin.

But it is a good start to run the script first from a myscripts dir to test the script.
When you think you can use it put in the home bin.

:bird:

1 Like

Update:

  • added creation date to the list.

:bird:

Thank you very much, but unfortunately, since I’m unable to resolve the issues I’m having with Mabox, I’ve decided to abandon the distro.
I can’t find answers to my questions, so I can’t resolve them.
Wish you success.

Update:

  • added manjaro forum for hits.
  • coloring URL mabox(green), manjaro(blue).

:bird:

Update:

  • Set viewer to bat if available, otherwise fallback to cat.
  • Coloring.
  • Order of output first Manjaro | Mabox topics.
    For quicker acces of Mabox topics.

Search Mabox From Cli…Script

:bird:

Update:

  • added Endevouros forum to the hits.
  • coloring
  • green mabox
  • blue manjaro
  • orange endevouros

:bird:

UPDATED:
Stupid script to search Mabox, Endeavour and Manjaro forum for issues and topics.

Now with bookmark and search sessions, etc.

Type keywords to search
!sessions → list past sessions
!open-session N → reopen session N
!clear → clear current session results
!bookmarks → show bookmarks
!bookmark N [N …] → save result N
!delbookmark N [N …] → remove bookmark(s) by number
!open N → open result N in browser
!new [name] → start new search session
Ctrl+C to quit

:bird: