diff --git a/config/settings/settings.conf b/config/settings/settings.conf index d6f74425..1e3bcb74 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -218,16 +218,24 @@ quickMenu=speech#rate;speech#pitch;speech#volume # Custom prompt patterns for silence until prompt feature # You can add your own shell prompt patterns as regular expressions # Each pattern should be on a separate line, format: customPatterns=pattern1,pattern2,pattern3 -# Examples: +# +# Built-in patterns include: +# - Shell prompts: $, #, >, user@host$, [user@host]$, bash-5.1$ +# - Package manager prompts: [Y/n], [y/N], [Yes/No], (Y/n), (y/N) +# - sudo prompts: [sudo] password for user:, Password:, user's password: +# - Confirmation prompts: Press any key, Are you sure?, Please confirm +# +# Custom pattern examples: # For PS1='[\u@\h \W] \$ ' use: \[.*@.*\s.*\]\s*[$#>]\s* # For "[user@hostname ~] $" use: \[.*@.*\s.*\]\s*[$#>]\s* # For custom prompts ending with specific strings, use patterns like: .*your_prompt_ending$ +# For custom package manager prompts: .*your_package_manager.*\[[YyNn]/[YyNn]\].* customPatterns= # Specific prompt strings to match exactly (useful for very specific custom prompts) # Format: exactMatches=prompt1,prompt2,prompt3 # Examples: -# exactMatches=[storm@fenrir ~] $,[root@fenrir ~] # +# exactMatches=[storm@fenrir ~] $,[root@fenrir ~] #,Continue installation? [Y/n] exactMatches= [time] diff --git a/src/fenrirscreenreader/commands/commands/silence_until_prompt.py b/src/fenrirscreenreader/commands/commands/silence_until_prompt.py index 4c9008cf..e9eb7607 100644 --- a/src/fenrirscreenreader/commands/commands/silence_until_prompt.py +++ b/src/fenrirscreenreader/commands/commands/silence_until_prompt.py @@ -74,12 +74,37 @@ class command(): # Add default shell prompt patterns promptPatterns.extend([ - r'^\s*\\\$\s*$', # Just $ (with whitespace) + r'^\s*\$\s*$', # Just $ (with whitespace) r'^\s*#\s*$', # Just # (with whitespace) r'^\s*>\s*$', # Just > (with whitespace) r'.*@.*[\\\$#>]\s*$', # Contains @ and ends with prompt char (user@host style) r'^\[.*\]\s*[\\\$#>]\s*$', # [anything]$ style prompts r'^[a-zA-Z0-9._-]+[\\\$#>]\s*$', # Simple shell names like bash-5.1$ + + # Interactive prompt patterns + # Package manager confirmation prompts + r'.*\?\s*\[[YyNn]/[YyNn]\]\s*$', # ? [Y/n] or ? [y/N] style + r'.*\?\s*\[[Yy]es/[Nn]o\]\s*$', # ? [Yes/No] style + r'.*\?\s*\([YyNn]/[YyNn]\)\s*$', # ? (Y/n) or ? (y/N) style + r'.*\?\s*\([Yy]es/[Nn]o\)\s*$', # ? (Yes/No) style + r'.*continue\?\s*\[[YyNn]/[YyNn]\].*$', # "continue? [Y/n]" style + r'.*ok\s*\[[YyNn]/[YyNn]\].*$', # "Is this ok [y/N]:" style + r'^::.*\?\s*\[[YyNn]/[YyNn]\].*$', # pacman ":: Proceed? [Y/n]" style + + # Authentication prompts + r'^\[[Ss]udo\]\s*[Pp]assword\s*for\s+.*:\s*$', # [sudo] password for user: + r'^[Pp]assword\s*:\s*$', # Password: + r'.*[Pp]assword\s*:\s*$', # general password prompts + r".*'s\s*[Pp]assword\s*:\s*$", # user's password: + r'^[Ee]nter\s+[Pp]assphrase.*:\s*$', # Enter passphrase: + r'^[Pp]lease\s+enter\s+[Pp]assphrase.*:\s*$', # Please enter passphrase: + + # General confirmation and continuation prompts + r'^[Pp]ress\s+any\s+key\s+to\s+continue.*$', # Press any key to continue + r'^[Aa]re\s+you\s+sure\?\s*.*$', # Are you sure? + r'^[Pp]lease\s+confirm.*$', # Please confirm + r'.*confirm.*\([YyNn]/[YyNn]\).*$', # confirm (y/n) + r'.*\([Yy]/[Nn]\)\s*$', # ends with (Y/n) or (y/N) ]) for pattern in promptPatterns: diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/66000-prompt_detector.py b/src/fenrirscreenreader/commands/onScreenUpdate/66000-prompt_detector.py index d172ba8a..4944442e 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/66000-prompt_detector.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/66000-prompt_detector.py @@ -68,12 +68,37 @@ class command(): # Add default shell prompt patterns promptPatterns.extend([ - r'^\s*\\\$\s*$', # Just $ (with whitespace) + r'^\s*\$\s*$', # Just $ (with whitespace) r'^\s*#\s*$', # Just # (with whitespace) r'^\s*>\s*$', # Just > (with whitespace) r'.*@.*[\\\$#>]\s*$', # Contains @ and ends with prompt char (user@host style) r'^\[.*\]\s*[\\\$#>]\s*$', # [anything]$ style prompts r'^[a-zA-Z0-9._-]+[\\\$#>]\s*$', # Simple shell names like bash-5.1$ + + # Interactive prompt patterns + # Package manager confirmation prompts + r'.*\?\s*\[[YyNn]/[YyNn]\]\s*$', # ? [Y/n] or ? [y/N] style + r'.*\?\s*\[[Yy]es/[Nn]o\]\s*$', # ? [Yes/No] style + r'.*\?\s*\([YyNn]/[YyNn]\)\s*$', # ? (Y/n) or ? (y/N) style + r'.*\?\s*\([Yy]es/[Nn]o\)\s*$', # ? (Yes/No) style + r'.*continue\?\s*\[[YyNn]/[YyNn]\].*$', # "continue? [Y/n]" style + r'.*ok\s*\[[YyNn]/[YyNn]\].*$', # "Is this ok [y/N]:" style + r'^::.*\?\s*\[[YyNn]/[YyNn]\].*$', # pacman ":: Proceed? [Y/n]" style + + # Authentication prompts + r'^\[[Ss]udo\]\s*[Pp]assword\s*for\s+.*:\s*$', # [sudo] password for user: + r'^[Pp]assword\s*:\s*$', # Password: + r'.*[Pp]assword\s*:\s*$', # general password prompts + r".*'s\s*[Pp]assword\s*:\s*$", # user's password: + r'^[Ee]nter\s+[Pp]assphrase.*:\s*$', # Enter passphrase: + r'^[Pp]lease\s+enter\s+[Pp]assphrase.*:\s*$', # Please enter passphrase: + + # General confirmation and continuation prompts + r'^[Pp]ress\s+any\s+key\s+to\s+continue.*$', # Press any key to continue + r'^[Aa]re\s+you\s+sure\?\s*.*$', # Are you sure? + r'^[Pp]lease\s+confirm.*$', # Please confirm + r'.*confirm.*\([YyNn]/[YyNn]\).*$', # confirm (y/n) + r'.*\([Yy]/[Nn]\)\s*$', # ends with (Y/n) or (y/N) ]) for pattern in promptPatterns: diff --git a/src/fenrirscreenreader/fenrirVersion.py b/src/fenrirscreenreader/fenrirVersion.py index 333f665a..542115d6 100644 --- a/src/fenrirscreenreader/fenrirVersion.py +++ b/src/fenrirscreenreader/fenrirVersion.py @@ -4,5 +4,5 @@ # Fenrir TTY screen reader # By Chrys, Storm Dragon, and contributers. -version = "2025.06.07" +version = "2025.06.08" codeName = "testing"