Preserve terminal state across sessions
martanne opened this issue · comments
abduco currently deliberately operates on the raw I/O byte stream and does not try interpret any communication happening between the supervised program and the attached terminals.
As a consequence the terminal state is currently not preserved across detach/attach cycles. This is a deliberate design decision. To properly fix this another utility (e.g. dvtm(1)
) which already keeps track of the terminal state would need to be notified when a session is re-attached (e.g. by means of a signal) and restore it accordingly.
I would like to eventually implement that, but it is currently not a high priority. Mostly because the use cases that I am interested in, work "good enough".
I hope that clarifies the reason for issues like #23, #26 and #31.
I've run into an issue that I suspect is also caused by this.
When I do the following,
- launch terminal (Alacritty, running Bash)
- run neovim in an abduco session:
abduco -c test nvim -u NONE
- detach
- switch focus away from terminal window (e.g. by running
echo foo | dmenu
, or simplycat
and then selecting a different X window)
my terminal outputs ^[[O
when it loses focus, and ^[[I
when it regains focus.
It looks like Alacritty listens for input focus events, and upon receiving one, it writes a control sequence to the pty, using FocusIn/FocusOut sequences
ESC [ I
if focus was gainedESC [ O
if focus was lost
If I reattach to the neovim session and quit neovim, my terminal returns to the correct behavior.