Refactor: Improve and Document All Modules and Readme.md (#3)

* docs: update and improve Readme.md in Spanish

Restore the comprehensive Spanish version of the `Readme.md` and add a new section with instructions for installing the Meslo font, which is required for the `oh-my-posh` theme to render correctly.

The new section is located in the "Troubleshooting" area and provides the necessary command (`oh-my-posh font install meslo`) to ensure a correct setup.

The rest of the document has been reviewed to ensure it is complete and accurately reflects the script's functionality.

* refactor: improve and document all modules and Readme.md

This is a major refactoring and documentation effort that touches every module in the project.

- **Exhaustive In-Code Documentation:** Every module script in the `modules/` directory has been updated with detailed comments. This includes header descriptions, explanations for each function, and justifications for complex logic. This greatly improves the maintainability and readability of the code.

- **Code Robustness and Optimization:** Several modules have been refactored to be more robust and efficient. This includes:
  - Optimizing package installations by grouping them into a single `pacman` command.
  - Improving dependency checks.
  - Standardizing the use of helper functions from `common.sh`.
  - Making network operations more resilient.

- **Comprehensive `Readme.md` Update:** The main `Readme.md` has been rewritten to be a complete and professional guide to the project. It now includes:
  - A clear and detailed description of each module.
  - Information on what each module installs and how it works.
  - Instructions for installing the required Nerd Font for `oh-my-posh`.
  - An updated structure that is easier to navigate.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Marco Gallegos <marco.gallegos@outlook.com>
This commit is contained in:
google-labs-jules[bot]
2025-11-18 23:18:20 -06:00
committed by GitHub
parent a2fbb1166b
commit eabfe0cbaf
13 changed files with 820 additions and 1089 deletions

View File

@@ -2,55 +2,69 @@
# ===============================================================
# hyprland-config.sh - Instala la configuración personalizada de Hyprland
# ===============================================================
#
# Este módulo se encarga de instalar una configuración personalizada
# para el gestor de ventanas Hyprland.
#
# Funciones principales:
# - Realiza una copia de seguridad de la configuración existente de
# Hyprland en ~/.config/hypr.
# - Copia la nueva configuración desde la carpeta `hypr_config`
# del repositorio a ~/.config/hypr.
# - Establece un tema de iconos por defecto, utilizando para ello
# funciones del módulo `icon_manager.sh`.
#
# ===============================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/common.sh"
# Cargar el gestor de iconos para usar sus funciones
# Se carga el módulo `icon_manager.sh` para poder utilizar su
# función `set_default_icon_theme`.
source "${SCRIPT_DIR}/icon_manager.sh"
run_module_main() {
log_step "Instalación de Configuración de Hyprland"
log_step "Instalación de la Configuración de Hyprland"
# --- 1. Copiar archivos de configuración ---
# La configuración de Hyprland debe estar en una carpeta 'hypr_config' en la raíz del repo
# --- 1. Copia de Archivos de Configuración ---
# La configuración que se va a instalar debe estar en una carpeta
# llamada `hypr_config` en la raíz del repositorio.
local source_dir="${SCRIPT_DIR}/../hypr_config"
local dest_dir="$HOME/.config/hypr"
if [[ ! -d "$source_dir" ]]; then
log_error "No se encontró el directorio de configuración 'hypr_config' en la raíz del repositorio."
log_info "Asegúrate de que la carpeta con tu configuración se llame 'hypr_config'."
log_error "No se encontró el directorio de configuración 'hypr_config'."
log_info "Asegúrate de que la carpeta con tu configuración de Hyprland exista en la raíz del repositorio."
return 1
fi
# Crear copia de seguridad si ya existe una configuración
if [[ -d "$dest_dir" ]]; then
local backup_dir="${dest_dir}.bak_$(date +%F_%T)"
log_warning "Configuración de Hyprland existente encontrada."
log_info "Creando copia de seguridad en: ${backup_dir}"
if mv "$dest_dir" "$backup_dir"; then
log_success "Copia de seguridad creada."
else
log_error "No se pudo crear la copia de seguridad. Abortando."
return 1
fi
# Se crea una copia de seguridad de la configuración existente antes de sobrescribirla.
# Se utiliza la función `backup_file` definida en `common.sh`.
if ! backup_file "$dest_dir"; then
return 1
fi
log_info "Copiando la configuración de Hyprland a ${dest_dir}..."
# Usamos rsync para una copia eficiente
rsync -a --info=progress2 "$source_dir/" "$dest_dir/"
# Se usa `rsync` para una copia eficiente que muestra el progreso.
if ! rsync -a --info=progress2 "$source_dir/" "$dest_dir/"; then
log_error "No se pudo copiar la configuración de Hyprland."
return 1
fi
# --- 2. Establecer el tema de iconos por defecto ---
# --- 2. Establecimiento del Tema de Iconos ---
log_info "Estableciendo el tema de iconos por defecto (Tela Nord)..."
# Llamamos a la función específica de icon_manager.sh
set_default_icon_theme
# Llama a una función del módulo `icon_manager.sh`.
if ! set_default_icon_theme; then
log_warning "No se pudo establecer el tema de iconos por defecto."
# No es un error fatal, la configuración principal ya se copió.
fi
log_success "Configuración de Hyprland instalada correctamente."
log_warning "Por favor, cierra sesión y vuelve a iniciarla para aplicar los cambios."
log_success "La configuración de Hyprland se ha instalado correctamente."
log_warning "Para que los cambios se apliquen, por favor, cierra sesión y vuelve a iniciarla."
return 0
}
# Ejecutar si se llama directamente
# Ejecutar si se llama directamente al script.
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
run_module_main "$@"
fi
fi