diff --git a/README.md b/README.md index 868b50d5..a012da2e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ # Fenrir -An TTY screenreader for Linux. -In theorie its not limited to linux. but i currently only provide drivers for that because I do not have an ohter system here. If you want to help or write drivers to make it work on other systems, just let me know. +A TTY screenreader for Linux. +In theory it's not just limited to Linux. but i currently only provide drivers for that since I do not have another system here. If you want to help or write drivers to make it work on other systems, just let me know. This software is licensed under the LGPL v3 . # Requirements (core) - linux (currently only screen and input drivers available for that) - python3 >= 3.3 +- python-configargparse - screen, input, speech, sound or braille drivers see "Features, Drivers, Extras". # Features, Drivers, Extras # Input Drivers: - "evdevDriver" input driver for linux evdev - - python-evdev + - python-evdev >=0.6.3 - loaded uinput kernel module - ReadWrite permission - /dev/input @@ -41,7 +42,7 @@ This software is licensed under the LGPL v3 . - "genericDriver" sound driver for sound as subprocess: - sox - "gstreamerDriver" sound driver for gstreamer - - gstreamer 1.x + - gstreamer >=1.0 - GLib - "dummyDriver" sound driver for debugging @@ -54,12 +55,12 @@ This software is licensed under the LGPL v3 . # installation - Archlinux: PKGBUILD in AUR -- install.sh (there is currently no uninstall) -- run from git: +- Manual: run install.sh and uninstall.sh as root +- you also can just run it from Git without installing: You can just run the following as root: cd src/fenrir-package/ sudo ./fenrir -Settings "settings.conf" is located in the "config" directory. +Settings "settings.conf" is located in the "config" directory or after installation in /etc/fenrir/settings. Take care that the used drivers in the config matching your installed drivers. By default it uses: - sound driver: genericDriver (via sox, could configured in settings.conf) diff --git a/TODO v2.0 b/TODO v2.0 index 941c50f6..d517832f 100644 --- a/TODO v2.0 +++ b/TODO v2.0 @@ -3,13 +3,13 @@ ToDo list for Fenrir Version 2.0 General: - implement onScreenUpdate commands read highlighted text mode -- translateable (easy for contribute) +- translateable (easy for contribution) http://www.supernifty.org/blog/2011/09/16/python-localization-made-easy/ - be more event based (vcsa sets POLLPRI) http://scotdoyle.com/python-epoll-howto.html - try to make it more asynchronus - multpible threads -- leave revew on typing +- leave review on typing - implement commands attributes_curr_char @@ -28,7 +28,7 @@ Braille Support: print cursor in textmode command toggle used cursor (in manual brailleFocusMode) capture input from braile - make routing keys assignable in keyboard + make routing keys assignable by keyboard make brailleTable configurable pkg-config --variable=tablesdir liblouis http://mielke.cc/brltty/doc/Manual-BrlAPI/English/BrlAPI.html @@ -40,21 +40,21 @@ Driver: - implement PTY Screen driver (to use gnome-terminal and other terminal emulators) https://docs.python.org/3.2/library/pty.html - implement PTY Input driver -- ATK input driver (dont grab on graphical interface) +- ATK input driver (don't grab on graphical interface) - implement speechdriver generic -- implement autodetection of plugged and removed input devices (python-pyudev) for evdev driver +- implement autodetection of plugged and unplugged input devices (python-pyudev) for evdev driver http://askubuntu.com/questions/508236/how-can-i-run-code-whenever-a-usb-device-is-unplugged-without-requiring-root - try to autodetect encoding https://stackoverflow.com/questions/6396659/how-do-you-get-the-encoding-of-the-terminal-from-within-a-python-script Settings: -- configuration should be overwriteable with parameter and alternative paths +- configuration should be overwritable with parameter and alternative paths - write settings - menue for settings configuration #storm Application Profiles - reimplement process detection without subprocessing -- reuse new porcess detection code for X11 detection +- reuse new process detection code for X11 detection - fenrir is not able to detect the current application inside of screen. ps -e -H -o pid,pgrp,ppid,tty,cmd http://stackoverflow.com/questions/24861351/how-to-detect-if-python-script-is-being-run-as-a-background-process/24862213 diff --git a/config/settings/settings.conf b/config/settings/settings.conf index ef7ff187..dccf3114 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -13,19 +13,19 @@ driver=genericDriver # For the current user. theme=default -# Sound volume controls how loud the sounds for your chosen soundpack are. +# Sound volume controls how loud the sounds for your selected soundpack are. # 0 is quietest, 1.0 is loudest. volume=1.0 # shell commands for generic sound driver -# the folowing variable are substituded +# the folowing variable are substituted # fenrirVolume = the current volume setting # fenrirSoundFile = the soundfile for an soundicon # fenrirFrequence = the frequence to play # fenrirDuration = the duration of the frequence -# the following command is used for play a soundfile +# the following command is used to play a soundfile genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile -#the following command is used for generating a frequence beep +#the following command is used to generate a frequency beep genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence [speech] @@ -37,7 +37,7 @@ driver=speechdDriver #driver=espeakDriver -# The rate selects how fast fenrir will speak. Options range from 0, slowest, to 1.0, fastest. +# The rate selects how fast Fenrir will speak. Options range from 0, slowest, to 1.0, fastest. rate=0.65 # Pitch controls the pitch of the voice, select from 0, lowest, to 1.0, highest. @@ -49,15 +49,15 @@ capitalPitch=0.9 volume=1.0 # Module is used for speech-dispatcher, to select the speech module you want to use. -# Consult speech-dispatcher's configuration and help ti find out which modules are available. +# Consult speech-dispatcher's configuration and help Fenrir find out which modules are available. # The default is espeak. module=espeak # Voice selects the varient you want to use, for example, f5 will use the female voice #5 in espeak, -# or if using the espeak module in speech-dispatcher. To find out which voices are available, consult the documentation provided with your chosen synthesizer. +# or if using the espeak module in speech-dispatcher. To find out which voices are available, consult the documentation provided with your selected synthesizer. voice= -# Select the language you want fenrir to use. +# Select the language you want Fenrir to use. language=english-us # Read new text as it happens? @@ -105,7 +105,7 @@ autodetectSuspendingScreen=True driver=evdevDriver # filter input devices NOMICE, ALL or a DEVICE NAME device=ALL -# gives fenrir exclusive access to the keyboard and let consume keystrokes. +# gives Fenrir exclusive access to the keyboard and lets it control keystrokes. grabDevices=True ignoreShortcuts=False # the current shortcut layout located in /etc/fenrir/keyboard diff --git a/install.sh b/install.sh index f64706a0..8595ee3f 100755 --- a/install.sh +++ b/install.sh @@ -1,27 +1,61 @@ #!/bin/bash -#Basic install script for fenrir. -read -p "This will install fenrir. Press ctrl+c to cancil, or enter to continue." continue -install -m755 -d /opt/fenrir -install -m755 -d /usr/share/fenrir/scripts -install -m755 -d /usr/share/fenrir/tools -install -m755 -d /etc/fenrir/punctuation -install -m644 -D "config/keyboard/desktop.conf" /etc/fenrir/keyboard/desktop.conf -install -m644 -D "config/keyboard/desktop.conf" /etc/fenrir/keyboard/desktop.conf -install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf -install -d /usr/share/sounds/fenrir -install -m644 -D "autostart/systemd/fenrir.service" /usr/lib/systemd/system/fenrir.service +#Basic install script for Fenrir. +read -p "This will install Fenrir. Press ctrl+c to cancel, or enter to continue." continue +# fenrir main application +install -m755 -d /opt/fenrir cp -a src/fenrir/* /opt/fenrir -cp -a config/scripts/* /usr/share/fenrir/scripts -cp -a config/punctuation/* /etc/fenrir/punctuation -cp -a config/sound/* /usr/share/sounds/fenrir +install -m644 -D "autostart/systemd/fenrir.service" /usr/lib/systemd/system/fenrir.service +ln -s /opt/fenrir/fenrir-daemon /usr/bin/fenrir + +# tools +install -m755 -d /usr/share/fenrir/tools cp -a tools/* /usr/share/fenrir/tools -ln -s /opt/fenrir/fenrir-daemon /usr/bin/fenrir +# scripts +install -m755 -d /usr/share/fenrir/scripts +cp -a "config/scripts/wlan__-__key_y.sh" /usr/share/fenrir/scripts/ + +# keyboard +install -m644 -D "config/keyboard/desktop.conf" /etc/fenrir/keyboard/desktop.conf +install -m644 -D "config/keyboard/laptop.conf" /etc/fenrir/keyboard/laptop.conf + +# punctuation +install -m755 -d /etc/fenrir/punctuation +cp -a config/punctuation/* /etc/fenrir/punctuation + +# sound +install -d /usr/share/sounds/fenrir +cp -a config/sound/default /usr/share/sounds/fenrir/default +cp -a config/sound/default-wav /usr/share/sounds/fenrir/default-wav +cp -a config/sound/template /usr/share/sounds/fenrir/template + +# config +if [ -f "/etc/fenrir/settings/settings.conf" ]; then + echo "Do you want to overwrite your current global settings? (y/n)" + read yn + if [ $yn = "Y" -o $yn = "y" ]; then + mv /etc/fenrir/settings/settings.conf /etc/fenrir/settings/settings.conf.bak + echo "Your old settings.conf has been backed up to settings.conf.bak." + install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf + else + install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf.current + fi +fi + + +# end message cat << EOF -To have fenrir start at boot: +Installation complete. +install path:/opt/fenrir +settings path:/etc/fenrir + +To test Fenrir +sudo systemctl start fenrir +To have Fenrir start on system boot: sudo systemctl enable fenrir + Pulseaudio users may want to run /usr/share/fenrir/tools/configure-pulseaudio -once as their user account and once as root. +once as their user account, then once as root. EOF diff --git a/known bugs.txt b/known bugs.txt index ddce00f3..03ef31c4 100644 --- a/known bugs.txt +++ b/known bugs.txt @@ -1,7 +1,13 @@ Known Bugs (Problems with the logic ): +- fenrir crashes on device unplug (remove device graceful) +- no autodetection of X if you start without GUI and use startx manual - word echo triggers twice if there are two spaces after an word and you arrow over them - spellcheck triggers twice if there are two spaces after an word and you arrow over them Glitches (improve diff results): - For example, in screen, it just tells me bell in window, but doesn't tell me which one. (southernprince) - alpine seems to have problems (southernprince) + +Questions: +- what is the correct codepage for cyrillic +- cyrillic diff --git a/src/fenrir/commands/commands/spell_check.py b/src/fenrir/commands/commands/spell_check.py index 7d37150a..2497c856 100644 --- a/src/fenrir/commands/commands/spell_check.py +++ b/src/fenrir/commands/commands/spell_check.py @@ -25,6 +25,9 @@ class command(): def getDescription(self): return 'checks the spelling of the current word' def updateSpellLanguage(self): + if not initialized: + self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True) + return self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') diff --git a/src/fenrir/commands/onInput/62000-spell_check.py b/src/fenrir/commands/onInput/62000-spell_check.py index c0fd4a4c..ee78e8f6 100644 --- a/src/fenrir/commands/onInput/62000-spell_check.py +++ b/src/fenrir/commands/onInput/62000-spell_check.py @@ -28,12 +28,15 @@ class command(): return 'No Description found' def updateSpellLanguage(self): + if not initialized: + self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True) + return self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') - + def run(self): if not initialized: - return + return if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): return if self.env['runtime']['inputManager'].noKeyPressed(): @@ -42,7 +45,7 @@ class command(): try: self.updateSpellLanguage() except: - return + return # just when horizontal cursor move worddetection is needed if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): diff --git a/src/fenrir/fenrir b/src/fenrir/fenrir index 2cd48ac8..fce4baac 100755 --- a/src/fenrir/fenrir +++ b/src/fenrir/fenrir @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Fenrir TTY screen reader diff --git a/src/fenrir/fenrir-daemon b/src/fenrir/fenrir-daemon index b66b331b..41b3bc27 100755 --- a/src/fenrir/fenrir-daemon +++ b/src/fenrir/fenrir-daemon @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Fenrir TTY screen reader diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index f0d4751b..7184af24 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -35,7 +35,6 @@ class driver(): with open(useScreen, 'w') as fd: for c in text: fcntl.ioctl(fd, termios.TIOCSTI, c) - time.sleep(0.005) def getCurrApplication(self): apps = [] diff --git a/tools/configure_pulse.sh b/tools/configure_pulse.sh index fbd382fe..f39162bd 100755 --- a/tools/configure_pulse.sh +++ b/tools/configure_pulse.sh @@ -11,6 +11,7 @@ if [ -f "$xdgPath/pulse/default.pa" ]; then read -p "This will replace the current file located at $xdgPath/pulse/default.pa, press enter to continue or control+c to abort. " continue fi echo '.include /etc/pulse/default.pa +load-module module-switch-on-connect load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse.sock' > $xdgPath/pulse/default.pa echo "If you have not yet done so, please run this script as root to write the client.conf file." else diff --git a/deinstall.sh b/uninstall.sh similarity index 74% rename from deinstall.sh rename to uninstall.sh index d72f9b5a..7fa6ed26 100644 --- a/deinstall.sh +++ b/uninstall.sh @@ -4,13 +4,19 @@ cat << EOF fenrir is going to remove. every script and settings are lost. EOF -read -p "This will remove fenrir and settings. Press ctrl+c to cancil, or enter to continue." continue + +# ask +read -p "This will remove fenrir and settings. Press ctrl+c to cancel, or enter to continue." continue + +# do it unlink /usr/bin/fenrir rm -r /opt/fenrir rm -r /usr/share/fenrir rm -r /etc/fenrir rm -r /usr/share/sounds/fenrir +rm /usr/lib/systemd/system/fenrir.service +# success message cat << EOF fenrir is removed EOF