Improve socket handling for -x spawned fenrir instances.

This commit is contained in:
Storm Dragon
2026-05-07 23:24:54 -04:00
parent 0273f9b956
commit 8638bca1d5
53 changed files with 794 additions and 1072 deletions
+3 -5
View File
@@ -22,7 +22,7 @@ src/fenrirscreenreader/
│ ├── onKeyInput/ # Key input hooks
│ └── help/ # Tutorial system
├── drivers/ # Driver implementations
│ ├── inputDriver/ # Input drivers (evdev, pty, atspi)
│ ├── inputDriver/ # Input drivers (evdev, x11)
│ ├── screenDriver/ # Screen drivers (vcsa, pty)
│ ├── speechDriver/ # Speech drivers (speechd, generic)
│ └── soundDriver/ # Sound drivers (generic, gstreamer)
@@ -36,8 +36,7 @@ Fenrir uses a pluggable driver architecture:
1. **Input Drivers**: Capture keyboard input
- evdevDriver: Linux evdev (recommended)
- ptyDriver: Terminal emulation
- atspiDriver: AT-SPI for desktop
- x11Driver: X11 terminal-scoped input
2. **Screen Drivers**: Read screen content
- vcsaDriver: Linux VCSA devices
@@ -83,7 +82,6 @@ Fenrir supports various event hooks:
- **onCursorChange**: Triggered when cursor moves
- **onScreenUpdate**: Triggered on screen content changes
- **onKeyInput**: Triggered on key presses
- **onByteInput**: Triggered on byte-level input
- **onScreenChanged**: Triggered when switching screens
## Development Setup
@@ -386,4 +384,4 @@ current_line = lines[self.env['screen']['newCursor']['y']]
- **Wiki**: https://git.stormux.org/storm/fenrir/wiki
- **Issues**: Use repository issue tracker
- **Community**: IRC irc.stormux.org #stormux
- **Email**: stormux+subscribe@groups.io
- **Email**: stormux+subscribe@groups.io
+22 -20
View File
@@ -13,13 +13,14 @@ fenrir \- A modern, modular console screen reader for Linux
.IR SECTION#SETTING=VALUE;.. ]
.RB [ \-d ]
.RB [ \-p ]
.RB [ \-e ]
.RB [ \-E ]
.RB [ \-x ]
.RB [ \-\-x11-window-id
.IR WINDOWID ]
.RB [ \-F ]
.SH DESCRIPTION
Fenrir is a modern, modular, flexible and fast console screen reader written in Python 3.
It provides spoken feedback for Linux console applications and supports multiple interface types including TTY, terminal emulators, and desktop environments.
It provides spoken feedback for Linux console applications and supports Linux TTYs plus X11 terminal mode.
Fenrir features a modular driver architecture supporting multiple speech synthesizers, sound systems, input methods, and screen reading techniques. It includes advanced features like review mode, multiple clipboards, spell checking, bookmarks, and configurable key bindings.
@@ -53,14 +54,6 @@ Enable debug mode. Debug information will be logged to /var/log/fenrir.log.
.BR \-p ", " \-\-print
Print debug messages to screen in addition to logging them.
.TP
.BR \-e ", " \-\-emulated-pty
Use PTY emulation with escape sequences for input. This enables usage in desktop/X11/Wayland environments and terminal emulators.
.TP
.BR \-E ", " \-\-emulated-evdev
Use PTY emulation with evdev for input (single instance mode).
.TP
.BR \-F ", " \-\-force-all-screens
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
@@ -234,14 +227,12 @@ gstreamerDriver - GStreamer-based
.IP \[bu] 4
debugDriver - Debug/testing
.TP
.TP
.B Input Drivers:
.IP \[bu] 4
evdevDriver - Linux evdev (recommended for Linux)
.IP \[bu] 4
ptyDriver - Terminal emulation (cross-platform)
.IP \[bu] 4
atspiDriver - AT-SPI for desktop environments
x11Driver - X11 terminal-scoped input for fenrir -x
.TP
.B Screen Drivers:
@@ -267,10 +258,6 @@ Start Fenrir as a daemon with default settings.
.B fenrir -f -d
Run Fenrir in foreground with debug output.
.TP
.B fenrir -e
Run Fenrir with PTY emulation for desktop/terminal use.
.TP
.B fenrir -o "speech#rate=0.8;sound#volume=0.5"
Override speech rate and sound volume settings.
@@ -300,6 +287,19 @@ enableCommandRemote=True
.SS Using socat with Unix Sockets
.TP
.B Instance Discovery:
.EX
# List registered Fenrir instances and their socket paths
echo "ls" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock
.EE
In X terminal mode (fenrir -x), multiple Fenrir instances can run at the
same time. Each instance has a private socket at
/tmp/fenrirscreenreader-<pid>.sock, and one instance may also own the
standard control socket. Use ls or "command ls" on the standard socket to
find the private socket for a specific instance.
.TP
.B Basic Speech Control:
.EX
@@ -355,6 +355,8 @@ command say <text> - Speak the specified text
command interrupt - Stop current speech
.IP \[bu] 2
command tempdisablespeech - Disable speech until next key press
.IP \[bu] 2
ls / list / command ls / command list - List registered Fenrir instances
.TP
.B Settings Commands:
@@ -516,4 +518,4 @@ This software is licensed under the LGPL v3.
Full documentation: https://git.stormux.org/storm/fenrir/wiki
.PP
Support: stormux+subscribe@groups.io
Support: stormux+subscribe@groups.io
+17 -8
View File
@@ -1214,12 +1214,6 @@ Enable debug mode. Debug information will be logged.
`+-p, --print+`::
Print debug messages to screen in addition to logging them.
`+-e, --emulated-pty+`::
Use PTY emulation with escape sequences for input. This enables usage in desktop/X11/Wayland environments and terminal emulators.
`+-E, --emulated-evdev+`::
Use PTY emulation with evdev for input (single instance mode).
`+-F, --force-all-screens+`::
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
@@ -1277,6 +1271,19 @@ enable_command_remote=True
The `+socat+` command provides the easiest way to send commands to Fenrir:
===== Instance Discovery
....
# List registered Fenrir instances and their socket paths
echo "ls" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock
....
In X terminal mode (`+fenrir -x+`), multiple Fenrir instances can run at the
same time. Each instance has a private socket at
`+/tmp/fenrirscreenreader-<pid>.sock+`, and one instance may also own the
standard control socket. Use `+ls+` or `+command ls+` on the standard socket to
find the private socket for a specific instance.
===== Basic Speech Control
....
@@ -1338,6 +1345,7 @@ echo "command quitapplication" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-dea
* `+command say <text>+` - Speak the specified text
* `+command interrupt+` - Stop current speech
* `+command tempdisablespeech+` - Disable speech until next key press
* `+ls+` / `+list+` / `+command ls+` / `+command list+` - List registered Fenrir instances
*Clipboard Commands:*
@@ -1669,8 +1677,9 @@ off=`+False+`
==== Screen
The settings for screens, (TTY, PTY) are configured in the `+[screen]+`
section.
The settings for screen access are configured in the `+[screen]+`
section. `+vcsaDriver+` is used for Linux TTYs, and `+ptyDriver+` is
used by X11 terminal mode.
The driver to get the information from the screen:
+16 -3
View File
@@ -132,6 +132,18 @@ enable_command_remote=True # allow command execution
### Basic Usage with socat
#### Instance Discovery
```bash
# List registered Fenrir instances and their socket paths
echo "ls" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock
```
In X terminal mode (`fenrir -x`), multiple Fenrir instances can run at the same
time. Each instance has a private socket at `/tmp/fenrirscreenreader-<pid>.sock`,
and one instance may also own the standard control socket. Use `ls` or
`command ls` on the standard socket to find the private socket for a specific
instance.
#### Speech Control
```bash
# Interrupt current speech
@@ -193,6 +205,7 @@ echo "command quitapplication" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-dea
- `command say <text>` - Speak text
- `command interrupt` - Stop speech
- `command tempdisablespeech` - Disable until next key
- `ls` / `list` / `command ls` / `command list` - List registered Fenrir instances
**Settings Commands:**
- `setting set <section>#<key>=<value>` - Change setting
@@ -318,7 +331,7 @@ Fenrir automatically detects and provides audio feedback for progress indicators
### Input Drivers
- **evdevDriver** - Linux evdev (recommended for Linux)
- **ptyDriver** - Terminal emulation (cross-platform)
- **x11Driver** - X11 terminal-scoped input for `fenrir -x`
### Screen Drivers
- **vcsaDriver** - Linux VCSA devices (TTY)
@@ -341,8 +354,6 @@ fenrir [OPTIONS]
- `-o, --options SECTION#SETTING=VALUE;..` - Override settings
- `-d, --debug` - Enable debug mode
- `-p, --print` - Print debug to screen
- `-e, --emulated-pty` - PTY emulation for desktop use
- `-E, --emulated-evdev` - PTY + evdev emulation
- `-x, --x11` - PTY + X11 keyboard input scoped to the terminal window
- `--x11-window-id WINDOWID` - X11 window id to use for `--x11` terminal mode
- `-F, --force-all-screens` - Ignore ignoreScreen setting
@@ -368,6 +379,8 @@ X11 terminal mode uses the same keyboard layout files as TTY Fenrir. Supported F
This mode requires `python-xlib`.
For a dedicated PTY/terminal screen reader, see TDSR: https://github.com/tspivey/tdsr
## Troubleshooting
### No Speech
+2 -1
View File
@@ -1013,7 +1013,8 @@ Values: Integer,
* ''0'' = display size
* ''>0'' number of cells
==== Screen ====
The settings for screens, (TTY, PTY) are configured in the ''[screen]'' section.
The settings for screen access are configured in the ''[screen]'' section.
''vcsaDriver'' is used for Linux TTYs, and ''ptyDriver'' is used by X11 terminal mode.
The driver to get the information from the screen:
driver=vcsaDriver