Compare commits

..

10 Commits

14 changed files with 47 additions and 63 deletions

@ -4,7 +4,7 @@
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
[levelDict]
none:===:
some:===:-$~+*-/\@#
some:===:-$~+*-/\@#_
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~

@ -4,7 +4,7 @@
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
[levelDict]
none:===:
some:===:-$~+*-/\@
some:===:-$~+*-/\@_
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~

@ -4,7 +4,7 @@
# the entrys are seperated with :===: in words colon tripple equal colon ( to not collide with substitutions)
[levelDict]
none:===:
some:===:-$~+*-/\@
some:===:-$~+*-/\@_
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~

@ -15,7 +15,7 @@ theme=default
# Sound volume controls how loud the sounds for your selected soundpack are.
# 0 is quietest, 1.0 is loudest.
volume=1.0
volume=0.7
# shell commands for generic sound driver
# the folowing variable are substituted
@ -92,8 +92,8 @@ fenrirMaxRate=450
driver=vcsaDriver
encoding=auto
screenUpdateDelay=0.05
suspendingScreen=
autodetectSuspendingScreen=True
ignoreScreen=
autodetectIgnoreScreen=True
[keyboard]
driver=evdevDriver
@ -131,7 +131,7 @@ punctuationProfile=default
punctuationLevel=some
respectPunctuationPause=True
newLinePause=True
numberOfClipboards=10
numberOfClipboards=50
# used path for "export_clipboard_to_file"
# $user is replaced by username
#clipboardExportPath=/home/$user/fenrirClipboard
@ -190,7 +190,7 @@ enableSettingsRemote=True
enableCommandRemote=True
[barrier]
enabled=True
enabled=False
leftBarriers=│└┌─
rightBarriers=│┘┐─

@ -1,8 +1,9 @@
evdev>=1.1.2
daemonize>=2.5.0
dbus-python>=1.2.8
pyudev>=0.21.0
daemonize
evdev
pexpect
pyenchant
pyperclip
pyte>=0.7.0
rapidfuzz>=2.0.0
pyte
pyudev
pyxdg
setproctitle

@ -101,8 +101,8 @@ setup(
"dbus-python>=1.2.8",
"pyperclip",
"pyudev>=0.21.0",
"rapidfuzz>=2.0.0",
"setuptools",
"setproctitle",
"pexpect",
"pyte>=0.7.0",
],
@ -113,10 +113,10 @@ if not forceSettingsFlag:
# create settings file from example if not exist
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
try:
copyfile('/etc/fenrirscreenreader/settings/settings.conf.example', '/etc/fenrirscreenreader/settings/settings.conf')
copyfile('config/fenrirscreenreader/settings/settings.conf', '/etc/fenrirscreenreader/settings/settings.conf')
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
except:
pass
except OSError as e:
print(f"Could not copy settings file to destination: {e}")
else:
print('settings.conf file found. It is not overwritten automatical')

@ -6,6 +6,7 @@
from fenrirscreenreader.core import debug
import os
import importlib
import _thread
import pyperclip
@ -42,6 +43,7 @@ class command():
# Set display environment variable
os.environ['DISPLAY'] = display
# Attempt to set clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
pyperclip.copy(clipboard)
# If we get here without exception, we found a working display
success = True

@ -5,6 +5,7 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
import importlib
import _thread
import pyperclip
import os
@ -34,6 +35,7 @@ class command():
# Set display environment variable
os.environ['DISPLAY'] = display
# Attempt to get clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
clipboardContent = pyperclip.paste()
# If we get here without exception, we found a working display
if clipboardContent:

@ -176,7 +176,7 @@ class commandManager():
continue
def executeSwitchTrigger(self, trigger, unLoadScript, loadScript):
if self.env['runtime']['screenManager'].isSuspendingScreen():
if self.env['runtime']['screenManager'].isIgnoredScreen():
return
#unload
oldScript = unLoadScript
@ -199,7 +199,7 @@ class commandManager():
def executeDefaultTrigger(self, trigger, force=False):
if not force:
if self.env['runtime']['screenManager'].isSuspendingScreen():
if self.env['runtime']['screenManager'].isIgnoredScreen():
return
for command in sorted(self.env['commands'][trigger]):
if self.commandExists(command, trigger):
@ -214,7 +214,7 @@ class commandManager():
self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + command + str(e) ,debug.debugLevel.ERROR)
def executeCommand(self, command, section = 'commands'):
if self.env['runtime']['screenManager'].isSuspendingScreen():
if self.env['runtime']['screenManager'].isIgnoredScreen():
return
if self.commandExists(command, section):
try:

@ -52,12 +52,15 @@ class debugManager():
else:
if not self._fileOpened and fileMode:
self.openDebugFile()
timestamp = str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f'))
if onAnyLevel:
msg = 'ANY '+ str(level) + ' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f'))
levelInfo = 'INFO ANY'
else:
msg = str(level) +' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')
)
msg += ': ' + text
levelInfo = str(level)
# Changed order: text comes first, then level and timestamp
msg = text + ' - ' + levelInfo + ' ' + timestamp
if printMode:
print(msg)
if fileMode:

@ -55,7 +55,7 @@ class fenrirManager():
if self.environment['runtime']['inputManager'].noKeyPressed():
self.environment['runtime']['inputManager'].clearLastDeepInput()
if self.environment['runtime']['screenManager'].isSuspendingScreen():
if self.environment['runtime']['screenManager'].isIgnoredScreen():
self.environment['runtime']['inputManager'].writeEventBuffer()
else:
if self.environment['runtime']['helpManager'].isTutorialMode():

@ -7,7 +7,6 @@
from fenrirscreenreader.core import debug
from fenrirscreenreader.utils import screen_utils
import time, os, re, difflib
from rapidfuzz.distance import Levenshtein
class screenManager():
def __init__(self):
@ -60,7 +59,7 @@ class screenManager():
if self.isCurrScreenIgnoredChanged():
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
self.env['runtime']['inputManager'].handleDeviceGrab()
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
if not self.isIgnoredScreen(self.env['screen']['newTTY']):
self.update(eventData, 'onScreenChange')
self.env['screen']['lastScreenUpdate'] = time.time()
else:
@ -82,8 +81,7 @@ class screenManager():
return self.prevScreenIgnored
def updateScreenIgnored(self):
self.prevScreenIgnored = self.currScreenIgnored
self.currScreenIgnored = self.isSuspendingScreen(self.env['screen']['newTTY'])
self.currScreenIgnored = self.isIgnoredScreen(self.env['screen']['newTTY'])
def update(self, eventData, trigger='onUpdate'):
# set new "old" values
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
@ -146,11 +144,8 @@ class screenManager():
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
# Use the original differ for typing mode to preserve behavior
diff = self.differ.compare(oldScreenText, newScreenText)
diffList = list(diff)
typing = True
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
if tempNewDelta.strip() != '':
@ -158,26 +153,7 @@ class screenManager():
diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n']
typing = False
else:
# For screen changes, use the original differ
if self.isScreenChange() or trigger == 'onScreenChange':
diff = self.differ.compare(oldScreenText.split('\n'),
newScreenText.split('\n'))
diffList = list(diff)
else:
# Use rapidfuzz for normal updates - not for screen changes
try:
# Process line by line using rapidfuzz
old_lines = oldScreenText.split('\n')
new_lines = newScreenText.split('\n')
# Use standard differ for better word grouping
diff = self.differ.compare(old_lines, new_lines)
diffList = list(diff)
except Exception as e:
# Fall back to standard differ if there's any issue
self.env['runtime']['debug'].writeDebugOut('screenManager:update:rapidfuzz: ' + str(e), debug.debugLevel.ERROR)
diff = self.differ.compare(oldScreenText.split('\n'),
diff = self.differ.compare(oldScreenText.split('\n'),\
newScreenText.split('\n'))
diffList = list(diff)
@ -198,16 +174,16 @@ class screenManager():
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
def isSuspendingScreen(self, screen = None):
def isIgnoredScreen(self, screen = None):
if screen == None:
screen = self.env['screen']['newTTY']
ignoreScreens = []
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen')
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'ignoreScreen')
if fixIgnoreScreens != '':
ignoreScreens.extend(fixIgnoreScreens.split(','))
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectIgnoreScreen'):
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
self.env['runtime']['debug'].writeDebugOut('screenManager:isIgnoredScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
return (screen in ignoreScreens)
def isScreenChange(self):

@ -40,8 +40,8 @@ settingsData = {
'driver': 'vcsaDriver',
'encoding': 'auto',
'screenUpdateDelay': 0.1,
'suspendingScreen': '',
'autodetectSuspendingScreen': False,
'ignoreScreen': '',
'autodetectIgnoreScreen': False,
},
'general':{
'debugLevel': debug.debugLevel.DEACTIVE,

@ -4,5 +4,5 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
version = "2025.04.14"
version = "2025.04.28"
codeName = "master"