accessibility for vision impaired people added

This commit is contained in:
Jing Kohn 2025-10-29 14:00:13 +10:00
parent 0c12e69b81
commit bc5b9bc799
3 changed files with 527 additions and 0 deletions

166
README.md
View File

@ -911,6 +911,168 @@ Want to make this even more ridiculously sublime?
4. Update this README with the new application
5. Test thoroughly on a clean system
# ♿ ACCESSIBILITY FEATURES ♿
UltraBunt is committed to being accessible to all users, including those with visual impairments. We've implemented comprehensive Text-to-Speech (TTS) support to make the installation process fully accessible.
## 🔊 Text-to-Speech Integration
The accessibility-enhanced version of UltraBunt provides full voice guidance throughout the installation process using the `spd-say` command from Speech Dispatcher.
### 🎯 Key Accessibility Features
- **🗣️ Voice Announcements**: All menu options, prompts, and system messages are spoken aloud
- **👥 Female Voice**: Configured with a friendly female voice for better user experience
- **⚡ Moderate Speed**: Speech rate optimized for clarity and comprehension
- **🎵 Punctuation Support**: Important punctuation is vocalized for better context
- **🔄 Real-time Feedback**: Installation progress and status updates are announced
- **⚠️ Error Handling**: Graceful fallback when TTS is unavailable
### 🚀 Getting Started with Accessibility
#### Option 1: Use the Accessible Script (Recommended)
```bash
# Make the accessible script executable
chmod +x ultrabunt-accessible.sh
# Run the accessibility-enhanced version
./ultrabunt-accessible.sh
```
#### Option 2: Enable TTS in Main Script
```bash
# Export TTS environment variables before running
export ULTRABUNT_TTS_ENABLED=true
export ULTRABUNT_TTS_VOICE=female1
export ULTRABUNT_TTS_RATE=0
# Run the main script with TTS support
./ultrabunt.sh
```
### 📋 Prerequisites for TTS
The accessibility features require Speech Dispatcher to be installed:
```bash
# Install Speech Dispatcher (usually pre-installed on Ubuntu)
sudo apt update
sudo apt install speech-dispatcher espeak-ng
# Test TTS functionality
spd-say "Hello, UltraBunt accessibility is working!"
```
### ⚙️ TTS Configuration Options
The accessible version supports several voice configuration options:
| Setting | Default | Description |
|---------|---------|-------------|
| Voice Type | `female1` | Voice gender and variant |
| Speech Rate | `0` (moderate) | Speaking speed (-100 to +100) |
| Punctuation | `some` | Level of punctuation vocalization |
| Language | `en` | Speech language |
### 🎛️ Voice Settings
You can customize the TTS experience by modifying these environment variables:
```bash
# Voice selection (male1, male2, male3, female1, female2, female3, child_male, child_female)
export ULTRABUNT_TTS_VOICE="female1"
# Speech rate (-100 = very slow, 0 = normal, +100 = very fast)
export ULTRABUNT_TTS_RATE="0"
# Punctuation level (none, some, all)
export ULTRABUNT_TTS_PUNCTUATION="some"
# Language code
export ULTRABUNT_TTS_LANGUAGE="en"
```
### 🔧 How It Works
The accessibility system integrates seamlessly with the existing UltraBunt interface:
1. **Menu Navigation**: All menu categories and options are announced
2. **Installation Progress**: Package installations are narrated in real-time
3. **User Prompts**: Input requests and confirmations are spoken
4. **Status Updates**: System messages and warnings are vocalized
5. **Error Handling**: Installation errors and issues are announced clearly
### 🎪 Accessible Menu Experience
When using the accessible version, you'll hear:
- **Category Announcements**: "Development Tools menu with 15 options available"
- **Option Reading**: Each package name and description is spoken
- **Navigation Guidance**: Instructions for menu navigation
- **Selection Confirmation**: Confirmation of your choices
- **Installation Narration**: Real-time progress updates
### 🛠️ Technical Implementation
The accessibility features are implemented through:
- **`speak_if_enabled()` Function**: Core TTS functionality with ANSI color code filtering
- **Enhanced UI Functions**: `ui_msg_accessible()`, `ui_input_accessible()`, `ui_menu_accessible()`
- **Menu Integration**: TTS announcements in all menu functions
- **Progress Narration**: Voice feedback during package installations
- **Error Vocalization**: Spoken error messages and warnings
### 🔍 Troubleshooting TTS
If TTS isn't working:
1. **Check Speech Dispatcher**:
```bash
systemctl --user status speech-dispatcher
```
2. **Test spd-say directly**:
```bash
spd-say "Testing speech synthesis"
```
3. **Install missing components**:
```bash
sudo apt install speech-dispatcher espeak-ng pulseaudio
```
4. **Restart audio services**:
```bash
pulseaudio --kill
pulseaudio --start
```
### 🌟 Accessibility Best Practices
The UltraBunt accessibility implementation follows these principles:
- **Non-intrusive**: TTS can be easily disabled without affecting functionality
- **Informative**: All visual information has audio equivalents
- **Efficient**: Speech is concise but comprehensive
- **Customizable**: Users can adjust voice settings to their preferences
- **Fallback-ready**: Graceful degradation when TTS is unavailable
### 🎯 Future Accessibility Enhancements
Planned improvements include:
- **Keyboard Navigation**: Enhanced keyboard-only operation
- **Screen Reader Support**: Better compatibility with screen readers
- **Audio Cues**: Sound effects for different types of notifications
- **Voice Commands**: Voice-controlled menu navigation
- **Multi-language TTS**: Support for additional languages
### 💡 Tips for Visually Impaired Users
- Use the `ultrabunt-accessible.sh` script for the best experience
- The script will automatically detect and configure TTS settings
- All menu navigation can be done using standard keyboard controls
- Press `Ctrl+C` at any time to safely interrupt TTS and exit
- Installation progress is announced every few seconds during package installations
# 📜 LICENSE 📜
This project is licensed under the MIT License - because sharing is caring! seriously its just a bunch of bash stickytaped together go nuts.
@ -935,7 +1097,11 @@ The Ultimate Buntstaller isn't just a script - it's a statement. A statement tha
So go forth, brave user, and BUNTAGE ALL THE THINGS! 🎉
╔══════════════════════════════════════════════════════════════╗
║ "In a world of packages, dare to be a BUNTAGE!" ║
║ ║
║ - The Ultimate Buntstaller Philosophy ║
╚══════════════════════════════════════════════════════════════╝

262
ultrabunt-accessible.sh Executable file
View File

@ -0,0 +1,262 @@
#!/bin/bash
# Ultrabunt Accessible Installer
# Enhanced version with Text-to-Speech support for visually impaired users
# Uses spd-say (Speech Dispatcher) for audio feedback
# Color codes for visual users who might have partial sight
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
NC='\033[0m' # No Color
# TTS Configuration
TTS_ENABLED=true
TTS_VOICE="female1"
TTS_RATE="-20" # Slightly slower for clarity
TTS_PITCH="0" # Normal pitch
TTS_VOLUME="10" # Slightly louder
TTS_PUNCTUATION="some" # Read some punctuation for clarity
# Function to speak text using spd-say
speak_text() {
local text="$1"
local priority="${2:-text}" # Default priority is 'text'
if [[ "$TTS_ENABLED" == true ]] && command -v spd-say >/dev/null 2>&1; then
# Clean the text of ANSI color codes for speech
local clean_text=$(echo "$text" | sed 's/\x1b\[[0-9;]*m//g')
spd-say \
--voice-type "$TTS_VOICE" \
--rate "$TTS_RATE" \
--pitch "$TTS_PITCH" \
--volume "$TTS_VOLUME" \
--punctuation-mode "$TTS_PUNCTUATION" \
--priority "$priority" \
--wait \
"$clean_text" 2>/dev/null
fi
}
# Function to display and speak messages
announce() {
local message="$1"
local color="${2:-$WHITE}"
local priority="${3:-text}"
echo -e "${color}${message}${NC}"
speak_text "$message" "$priority"
}
# Function to check if Speech Dispatcher is available
check_tts_availability() {
if ! command -v spd-say >/dev/null 2>&1; then
echo -e "${RED}Warning: spd-say (Speech Dispatcher) not found!${NC}"
echo -e "${YELLOW}Text-to-speech will be disabled.${NC}"
echo -e "${CYAN}To install Speech Dispatcher on Ubuntu/Debian:${NC}"
echo -e "${WHITE}sudo apt update && sudo apt install speech-dispatcher${NC}"
echo ""
TTS_ENABLED=false
read -p "Press Enter to continue without TTS, or Ctrl+C to exit and install Speech Dispatcher..."
return 1
fi
return 0
}
# Function to test TTS and let user adjust settings
test_and_configure_tts() {
if [[ "$TTS_ENABLED" == true ]]; then
announce "Welcome to the Ultrabunt Accessible Installer!" "$GREEN" "important"
announce "This installer includes text-to-speech support for visually impaired users." "$CYAN"
echo ""
announce "Testing your text-to-speech settings..." "$YELLOW"
speak_text "This is a test of the text to speech system. Can you hear this clearly?"
echo ""
echo -e "${WHITE}TTS Settings Test Complete${NC}"
echo -e "${CYAN}Current settings:${NC}"
echo -e " Voice: ${WHITE}$TTS_VOICE${NC} (friendly female voice)"
echo -e " Speed: ${WHITE}$TTS_RATE${NC} (slightly slower for clarity)"
echo -e " Volume: ${WHITE}$TTS_VOLUME${NC} (slightly louder)"
echo -e " Punctuation: ${WHITE}$TTS_PUNCTUATION${NC} (reads some punctuation)"
echo ""
while true; do
echo -e "${YELLOW}TTS Configuration Options:${NC}"
echo -e " ${WHITE}1)${NC} Continue with current settings"
echo -e " ${WHITE}2)${NC} Make voice slower"
echo -e " ${WHITE}3)${NC} Make voice faster"
echo -e " ${WHITE}4)${NC} Make voice louder"
echo -e " ${WHITE}5)${NC} Make voice quieter"
echo -e " ${WHITE}6)${NC} Test current settings again"
echo -e " ${WHITE}7)${NC} Disable TTS and continue silently"
echo ""
read -p "Choose an option (1-7): " choice
speak_text "You selected option $choice"
case $choice in
1)
announce "Continuing with current TTS settings." "$GREEN"
break
;;
2)
TTS_RATE="-40"
announce "Voice speed set to slower. Testing..." "$CYAN"
speak_text "This is the new slower speed setting."
;;
3)
TTS_RATE="0"
announce "Voice speed set to normal. Testing..." "$CYAN"
speak_text "This is the normal speed setting."
;;
4)
TTS_VOLUME="30"
announce "Voice volume set to louder. Testing..." "$CYAN"
speak_text "This is the louder volume setting."
;;
5)
TTS_VOLUME="0"
announce "Voice volume set to normal. Testing..." "$CYAN"
speak_text "This is the normal volume setting."
;;
6)
announce "Testing current settings..." "$YELLOW"
speak_text "This is a test of your current text to speech settings. How does this sound?"
;;
7)
TTS_ENABLED=false
announce "Text-to-speech disabled. Continuing in silent mode." "$YELLOW"
break
;;
*)
announce "Invalid option. Please choose 1 through 7." "$RED"
;;
esac
done
fi
}
# Function to provide audio navigation help
provide_navigation_help() {
announce "Navigation Help for Ultrabunt Installer" "$CYAN" "important"
announce "This installer uses numbered menus for easy navigation." "$WHITE"
announce "Simply type the number of your choice and press Enter." "$WHITE"
announce "You can always type 'help' for assistance, or 'quit' to exit." "$WHITE"
announce "The installer will read all options aloud before asking for your choice." "$WHITE"
echo ""
}
# Function to announce menu options with audio
announce_menu_options() {
local menu_title="$1"
shift
local options=("$@")
announce "$menu_title" "$GREEN" "important"
announce "Available options:" "$CYAN"
for i in "${!options[@]}"; do
local option_num=$((i + 1))
announce "Option $option_num: ${options[$i]}" "$WHITE"
# Small pause between options for clarity
sleep 0.3
done
echo ""
announce "Please enter your choice:" "$YELLOW"
}
# Main function
main() {
clear
# Check if we're running on a Linux system
if [[ "$(uname)" != "Linux" ]]; then
announce "Error: This accessible installer is designed for Linux systems only." "$RED" "important"
announce "The main ultrabunt.sh script may work on other systems." "$YELLOW"
exit 1
fi
# Check TTS availability
check_tts_availability
# Welcome and TTS configuration
echo -e "${PURPLE}╔══════════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${PURPLE}║ ULTRABUNT ACCESSIBLE INSTALLER ║${NC}"
echo -e "${PURPLE}║ Enhanced for Visually Impaired Users ║${NC}"
echo -e "${PURPLE}╚══════════════════════════════════════════════════════════════════════════════╝${NC}"
echo ""
if [[ "$TTS_ENABLED" == true ]]; then
test_and_configure_tts
provide_navigation_help
# Ask if user wants to continue
announce "Are you ready to start the Ultrabunt installation?" "$GREEN"
announce "Type 'yes' to continue, 'help' for more information, or 'no' to exit." "$CYAN"
while true; do
read -p "Your choice: " user_response
speak_text "You entered: $user_response"
case "${user_response,,}" in
yes|y)
announce "Starting Ultrabunt installer with accessibility features enabled." "$GREEN" "important"
break
;;
help|h)
provide_navigation_help
announce "Type 'yes' to continue or 'no' to exit." "$CYAN"
;;
no|n|quit|exit)
announce "Exiting Ultrabunt accessible installer. Goodbye!" "$YELLOW" "important"
exit 0
;;
*)
announce "Please type 'yes' to continue, 'help' for information, or 'no' to exit." "$RED"
;;
esac
done
else
echo -e "${YELLOW}Running in silent mode (TTS disabled)${NC}"
echo -e "${WHITE}Press Enter to continue with the standard installer...${NC}"
read
fi
# Export TTS settings for the main script to use
export ULTRABUNT_TTS_ENABLED="$TTS_ENABLED"
export ULTRABUNT_TTS_VOICE="$TTS_VOICE"
export ULTRABUNT_TTS_RATE="$TTS_RATE"
export ULTRABUNT_TTS_PITCH="$TTS_PITCH"
export ULTRABUNT_TTS_VOLUME="$TTS_VOLUME"
export ULTRABUNT_TTS_PUNCTUATION="$TTS_PUNCTUATION"
# Launch the main Ultrabunt script
announce "Loading main Ultrabunt installer..." "$GREEN" "important"
# Check if main script exists
if [[ -f "./ultrabunt.sh" ]]; then
# Make sure it's executable
chmod +x ./ultrabunt.sh
# Run the main script with accessibility enhancements
./ultrabunt.sh "$@"
else
announce "Error: ultrabunt.sh not found in current directory!" "$RED" "important"
announce "Please ensure both scripts are in the same directory." "$YELLOW"
exit 1
fi
}
# Handle script interruption gracefully
trap 'announce "Installation interrupted by user. Goodbye!" "$YELLOW" "important"; exit 130' INT
# Run main function with all arguments
main "$@"

View File

@ -48,6 +48,96 @@ CURRENT_DIALOG_PRESET="standard"
declare -A INSTALLED_CACHE
# Session variables for database authentication
# ==============================================================================
# TTS (Text-to-Speech) Integration for Accessibility
# ==============================================================================
# TTS function to speak text if accessibility mode is enabled
speak_if_enabled() {
local text="$1"
local priority="${2:-text}"
# Only speak if TTS is enabled and spd-say is available
if [[ "${ULTRABUNT_TTS_ENABLED:-false}" == "true" ]] && command -v spd-say >/dev/null 2>&1; then
# Clean the text of ANSI color codes for speech
local clean_text=$(echo "$text" | sed 's/\x1b\[[0-9;]*m//g')
# Use the settings exported from the accessible script
spd-say \
--voice-type "${ULTRABUNT_TTS_VOICE:-female1}" \
--rate "${ULTRABUNT_TTS_RATE:--20}" \
--pitch "${ULTRABUNT_TTS_PITCH:-0}" \
--volume "${ULTRABUNT_TTS_VOLUME:-10}" \
--punctuation-mode "${ULTRABUNT_TTS_PUNCTUATION:-some}" \
--priority "$priority" \
--wait \
"$clean_text" 2>/dev/null &
fi
}
# Enhanced UI message function with TTS support
ui_msg_accessible() {
local title="$1"
local message="$2"
local height="${3:-10}"
local width="${4:-60}"
# Speak the title and message
speak_if_enabled "$title" "important"
speak_if_enabled "$message"
# Show the visual dialog
dialog --title "$title" --msgbox "$message" "$height" "$width"
}
# Enhanced input function with TTS support
ui_input_accessible() {
local title="$1"
local prompt="$2"
local default="${3:-}"
local height="${4:-10}"
local width="${5:-60}"
# Speak the title and prompt
speak_if_enabled "$title" "important"
speak_if_enabled "$prompt"
# Show the visual input dialog
dialog --title "$title" --inputbox "$prompt" "$height" "$width" "$default"
}
# Enhanced menu function with TTS support
ui_menu_accessible() {
local title="$1"
local prompt="$2"
local height="$3"
local width="$4"
local menu_height="$5"
shift 5
local options=("$@")
# Speak the title and prompt
speak_if_enabled "$title" "important"
speak_if_enabled "$prompt"
# Speak the available options
if [[ "${ULTRABUNT_TTS_ENABLED:-false}" == "true" ]]; then
speak_if_enabled "Available options:"
local i=0
while [ $i -lt ${#options[@]} ]; do
local option_key="${options[$i]}"
local option_text="${options[$((i+1))]}"
speak_if_enabled "Option $option_key: $option_text"
i=$((i+2))
sleep 0.2 # Small pause between options
done
speak_if_enabled "Please make your selection"
fi
# Show the visual menu dialog
dialog --title "$title" --menu "$prompt" "$height" "$width" "$menu_height" "${options[@]}"
}
MARIADB_SESSION_PASSWORD=""
MARIADB_SESSION_ACTIVE=false
@ -13618,6 +13708,9 @@ main() {
init_logging
log "Initializing Ultrabunt Ultimate Buntstaller..."
# Announce initialization if TTS is enabled
speak_if_enabled "Initializing Ultrabunt Ultimate Buntstaller" "important"
ensure_deps
log "Dependencies check completed"
@ -13627,19 +13720,25 @@ main() {
# Update buntage cache
log "Starting APT cache update..."
speak_if_enabled "Updating package cache, please wait..."
apt_update
log "APT cache update completed"
speak_if_enabled "Package cache updated successfully"
# Build buntage installation cache for fast lookups
speak_if_enabled "Building package installation cache..."
build_package_cache
speak_if_enabled "Package cache built successfully"
# Show main menu
log "Loading main menu..."
speak_if_enabled "Loading main menu" "important"
show_category_menu
log "Main menu completed"
# Farewell
log "Ultrabunt Ultimate Buntstaller exiting."
speak_if_enabled "Thank you for using Ultrabunt Ultimate Buntstaller. Goodbye!" "important"
ui_msg "Goodbye!" "Thanks for bunting Ultrabunt Ultimate Buntstaller!\n\nLog: $LOGFILE\nBackups: $BACKUP_DIR\n\n💡 Tip: Reboot to apply all changes."
}