From 9a3778e25f84e990989ad7a2d592a42f405d8883 Mon Sep 17 00:00:00 2001 From: Chrys Date: Tue, 22 Feb 2022 17:47:09 +0100 Subject: [PATCH] add key echo for capslock --- config/settings/espeak.settings.conf | 5 ++++- config/settings/settings-daemon.conf | 5 ++++- config/settings/settings-pty.conf | 5 ++++- config/settings/settings.conf | 5 ++++- config/settings/settings.conf.example | 5 ++++- config/settings/settings.conf.storm | 5 ++++- config/settings/speech-dispatcher.settings.conf | 5 ++++- .../commands/onCursorChange/15000-char_echo.py | 8 ++++++-- src/fenrirscreenreader/core/settingsData.py | 3 ++- 9 files changed, 36 insertions(+), 10 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index c929283e..64d5c086 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -134,7 +134,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=True +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 ## echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/config/settings/settings-daemon.conf b/config/settings/settings-daemon.conf index 67a2c140..851fd4a1 100644 --- a/config/settings/settings-daemon.conf +++ b/config/settings/settings-daemon.conf @@ -136,7 +136,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 # echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/config/settings/settings-pty.conf b/config/settings/settings-pty.conf index 67a2c140..851fd4a1 100644 --- a/config/settings/settings-pty.conf +++ b/config/settings/settings-pty.conf @@ -136,7 +136,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 # echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 31fc23c3..5edab59d 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -137,7 +137,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 # echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index c844d29a..c67130fb 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -137,7 +137,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 # echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index dcd59af1..0b8d2bd8 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -88,7 +88,10 @@ device=ALL grabDevices=True ignoreShortcuts=False keyboardLayout=desktop -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 charDeleteEcho=True wordEcho=False interruptOnKeyPress=True diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index adf108f1..c898d2ee 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -136,7 +136,10 @@ ignoreShortcuts=False # the current shortcut layout located in /etc/fenrirscreenreader/keyboard keyboardLayout=desktop # echo chars while typing. -charEcho=False +# 0 = None +# 1 = always +# 2 = only while capslock +charEchoMode=2 # echo deleted chars charDeleteEcho=True # echo word after pressing space diff --git a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py index dd62c658..b893766c 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py @@ -17,9 +17,13 @@ class command(): return 'No Description found' def run(self): - # enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): + # enabled? + active = self.env['runtime']['settingsManager'].getSettingAsInt('keyboard', 'charEchoMode') + if active == 0: return + if active == 2: + if not self.env['input']['newCapsLock']: + return # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) if xMove > 3: diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index 373262d9..96fa9a68 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -124,7 +124,8 @@ settingsData = { 'grabDevices': True, 'ignoreShortcuts': False, 'keyboardLayout': "desktop", - 'charEcho': False, + 'charEcho': False, # deprecated + 'charEchoMode': 2, 'charDeleteEcho': True, 'wordEcho': True, 'interruptOnKeyPress': True,