Add session handoff and resize-on-input
--adopt moves a running session to a new server binary while preserving clients, panes and scrollback. It works without a session name and notifies attached clients when adoption succeeds. Drop --no-resize-on-input in favor of the menu toggle.
This commit is contained in:
parent
3b3bb76842
commit
37f2527a47
3 changed files with 1116 additions and 107 deletions
43
README.md
43
README.md
|
|
@ -24,6 +24,9 @@ make
|
||||||
./murx -l # --list-sessions, list running sessions without attaching
|
./murx -l # --list-sessions, list running sessions without attaching
|
||||||
./murx -h # --help, usage and shortcuts
|
./murx -h # --help, usage and shortcuts
|
||||||
./murx -v # --version, print the version and exit
|
./murx -v # --version, print the version and exit
|
||||||
|
./murx --resize-on-input work # session size follows the last client with input
|
||||||
|
./murx --adopt # hand the default session to a new server binary
|
||||||
|
./murx --adopt work # same for a named session
|
||||||
```
|
```
|
||||||
|
|
||||||
Detach with `Ctrl-A d`. Run `murx` again to reattach.
|
Detach with `Ctrl-A d`. Run `murx` again to reattach.
|
||||||
|
|
@ -77,13 +80,35 @@ can change them in a running session (see [Menu](#menu)). To restore the
|
||||||
previous default display, use
|
previous default display, use
|
||||||
`murx --cwd --clock --hostname session`.
|
`murx --cwd --clock --hostname session`.
|
||||||
|
|
||||||
|
By default, the most recently attached or resized client sets the session size.
|
||||||
|
Use `--resize-on-input` (or the `Resize to last input` toggle in the
|
||||||
|
Configuration menu) to make any input from a client — a keystroke, menu
|
||||||
|
navigation, or a scrollback command — make that client the size source instead.
|
||||||
|
The menu toggle turns it off again. Both change the running session for all
|
||||||
|
attached clients; omitting the option preserves its current mode.
|
||||||
|
|
||||||
|
`--adopt` asks a running server to hand its session to a freshly started server
|
||||||
|
process, so an upgraded binary can take over without killing panes or
|
||||||
|
disconnecting clients. It accepts a session name, or no argument at all for the
|
||||||
|
default session: `murx --adopt` and `murx --adopt work` both work. Attached
|
||||||
|
clients keep their connections and see a short `Session adopted by new murx
|
||||||
|
server` notification. If no session is running, `--adopt` simply starts one.
|
||||||
|
|
||||||
|
Handoff requires cooperation from the server that is already running. Sessions
|
||||||
|
started by this version (or a later one) can be adopted after an upgrade.
|
||||||
|
Against an older server, `--adopt` prints a clear message and attaches normally;
|
||||||
|
those sessions still need one restart. The handoff carries the listening socket,
|
||||||
|
pty descriptors, client sockets, window layout, pane screens and scrollback, so
|
||||||
|
shells keep their process IDs and panes keep their contents.
|
||||||
|
|
||||||
## Upgrading from moerx
|
## Upgrading from moerx
|
||||||
|
|
||||||
The executable, source and manual are now `murx`, `murx.c` and `murx.1`.
|
The executable, source and manual are now `murx`, `murx.c` and `murx.1`.
|
||||||
Update aliases and scripts to use `murx`. The status label is now disabled
|
Update aliases and scripts to use `murx`. The status label is now disabled
|
||||||
by default; use `--murx` to enable it. Sessions use a separate `murx-<uid>` socket directory; finish
|
by default; use `--murx` to enable it. Sessions use a separate `murx-<uid>` socket directory; finish
|
||||||
existing sessions with the old executable before removing it. Existing
|
existing sessions with the old executable before removing it. Sessions started
|
||||||
sessions are not migrated automatically. Replace the optional remote SSH
|
by a handoff-capable build can be moved forward with `--adopt`; older ones are
|
||||||
|
not migrated automatically. Replace the optional remote SSH
|
||||||
hooks below and reload the remote shell: custom reports now use `murx-cwd`
|
hooks below and reload the remote shell: custom reports now use `murx-cwd`
|
||||||
and `murx-root`.
|
and `murx-root`.
|
||||||
|
|
||||||
|
|
@ -100,10 +125,12 @@ and `murx-root`.
|
||||||
works in programs such as Midnight Commander. Menus and prompts use normal
|
works in programs such as Midnight Commander. Menus and prompts use normal
|
||||||
cursor-key mode; detaching restores normal cursor keys in the outer terminal.
|
cursor-key mode; detaching restores normal cursor keys in the outer terminal.
|
||||||
- Home (Pos1) and End use the pane’s `screen-256color` key sequences.
|
- Home (Pos1) and End use the pane’s `screen-256color` key sequences.
|
||||||
- Multiple clients can attach to the same session. The most recently attached
|
- Multiple clients can attach to the same session. Normally the most recently
|
||||||
or resized client sets the session size; a larger client shows the session
|
attached or resized client sets the session size. With `--resize-on-input`,
|
||||||
centred in its terminal, while a smaller client shows the top-left part.
|
the client that most recently sent any input does instead. A larger client
|
||||||
`Ctrl-A R` forces the session back to the current client's terminal size.
|
shows the session centred in its terminal, while a smaller client shows the
|
||||||
|
top-left part. `Ctrl-A R` forces the session back to the current client's
|
||||||
|
terminal size.
|
||||||
- Panes run `$SHELL` as a login shell with `TERM=screen-256color` and
|
- Panes run `$SHELL` as a login shell with `TERM=screen-256color` and
|
||||||
`MURX=<session>`. They inherit the launching process's umask, so builds keep
|
`MURX=<session>`. They inherit the launching process's umask, so builds keep
|
||||||
their usual file permissions. After upgrading from a version that forced `077`,
|
their usual file permissions. After upgrading from a version that forced `077`,
|
||||||
|
|
@ -324,8 +351,8 @@ scrollback, forced resize and kill server. `Configuration...` contains:
|
||||||
- `Status line...` — position (top/bottom) and background (default, black
|
- `Status line...` — position (top/bottom) and background (default, black
|
||||||
`000000`, grey `191a1c`).
|
`000000`, grey `191a1c`).
|
||||||
- `Prefix...` — this client's Ctrl-key prefix, `a` through `z`.
|
- `Prefix...` — this client's Ctrl-key prefix, `a` through `z`.
|
||||||
- Toggles for the current directory, clock, `[murx]` label, hostname and pane
|
- Toggles for the current directory, clock, `[murx]` label, hostname, pane
|
||||||
titles.
|
titles and `Resize to last input`.
|
||||||
- `Reset display/status defaults`.
|
- `Reset display/status defaults`.
|
||||||
|
|
||||||
Press Enter on a toggle to turn it on or off. Settings changes apply
|
Press Enter on a toggle to turn it on or off. Settings changes apply
|
||||||
|
|
|
||||||
48
murx.1
48
murx.1
|
|
@ -12,6 +12,8 @@ murx \- small persistent terminal multiplexer
|
||||||
.RB [ \-m ]
|
.RB [ \-m ]
|
||||||
.RB [ \-n ]
|
.RB [ \-n ]
|
||||||
.RB [ \-t ]
|
.RB [ \-t ]
|
||||||
|
.RB [ \-\-resize\-on\-input ]
|
||||||
|
.RB [ \-\-adopt ]
|
||||||
.RB [ \-\- ]
|
.RB [ \-\- ]
|
||||||
.RI [ session ]
|
.RI [ session ]
|
||||||
.br
|
.br
|
||||||
|
|
@ -95,6 +97,27 @@ Show the hostname: prefix in window names and the outer terminal title.
|
||||||
.BR \-t ", " \-\-titles
|
.BR \-t ", " \-\-titles
|
||||||
Show the title row above each pane. Pane titles are off by default.
|
Show the title row above each pane. Pane titles are off by default.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-\-resize\-on\-input
|
||||||
|
Make the session size follow the client that most recently sent input.
|
||||||
|
Any bytes from a client count, including keystrokes, menu navigation and
|
||||||
|
scrollback commands. Attaching and resizing are used only until the first
|
||||||
|
input arrives. This changes the running session for all attached clients.
|
||||||
|
.TP
|
||||||
|
.B \-\-adopt
|
||||||
|
Ask a running server to hand its session to a newly started server process.
|
||||||
|
The session name is optional, so both
|
||||||
|
.B murx \-\-adopt
|
||||||
|
and
|
||||||
|
.B murx \-\-adopt session
|
||||||
|
work; without a name the default session 0 is used. Panes, client connections,
|
||||||
|
window layout, screens and scrollback survive the swap. Attached clients see a
|
||||||
|
short
|
||||||
|
.I Session adopted by new murx server
|
||||||
|
notification. If no session is running, a new one is started normally.
|
||||||
|
Handoff requires a cooperating server: sessions started by this version or a
|
||||||
|
later one can be adopted after an upgrade. Against an older server, murx
|
||||||
|
prints a clear message and attaches normally.
|
||||||
|
.TP
|
||||||
.BR \-h ", " \-\-help
|
.BR \-h ", " \-\-help
|
||||||
Print the text logo, program version, usage and keyboard shortcuts, then exit.
|
Print the text logo, program version, usage and keyboard shortcuts, then exit.
|
||||||
.TP
|
.TP
|
||||||
|
|
@ -103,7 +126,9 @@ Print the program version and exit.
|
||||||
.PP
|
.PP
|
||||||
Display options set a new session's values; the Configuration menu can
|
Display options set a new session's values; the Configuration menu can
|
||||||
change them in a running session. The cwd, clock, [murx] label, hostname
|
change them in a running session. The cwd, clock, [murx] label, hostname
|
||||||
and pane title options are off by default.
|
and pane title options are off by default. The default size mode uses
|
||||||
|
attach/resize recency; omitting \-\-resize\-on\-input preserves the running
|
||||||
|
session's mode.
|
||||||
To restore the previous default display, use
|
To restore the previous default display, use
|
||||||
.BR "murx \-\-cwd \-\-clock \-\-hostname session" .
|
.BR "murx \-\-cwd \-\-clock \-\-hostname session" .
|
||||||
.SH KEY BINDINGS
|
.SH KEY BINDINGS
|
||||||
|
|
@ -227,10 +252,11 @@ Use Up/Down or j/k to move and Enter to select. Left/Right or h/l enter and
|
||||||
leave submenus; q, Escape, or Ctrl-C closes the menu. Long menus scroll.
|
leave submenus; q, Escape, or Ctrl-C closes the menu. Long menus scroll.
|
||||||
The Configuration submenu sets the status line position and background
|
The Configuration submenu sets the status line position and background
|
||||||
(default, black or grey), the client prefix, display toggles for the directory,
|
(default, black or grey), the client prefix, display toggles for the directory,
|
||||||
clock, [murx] label and hostname, and resets display/status defaults (display toggles, status position and
|
clock, [murx] label, hostname and pane titles, a toggle for resizing to the
|
||||||
background). Session
|
last client with input, and resets display/status defaults (display toggles,
|
||||||
settings affect all attached clients; the prefix is per-client. Changes take
|
status position and background). Session settings affect all attached clients;
|
||||||
effect immediately and are not saved to disk.
|
the prefix is per-client. Changes take effect immediately and are not saved to
|
||||||
|
disk.
|
||||||
In prompts use Enter to accept, Escape or Ctrl-C to cancel, Backspace or Ctrl-H
|
In prompts use Enter to accept, Escape or Ctrl-C to cancel, Backspace or Ctrl-H
|
||||||
to delete, and Ctrl-U to clear.
|
to delete, and Ctrl-U to clear.
|
||||||
Confirm destructive actions with y, Y or Enter; n, N, Escape or Ctrl-C cancels.
|
Confirm destructive actions with y, Y or Enter; n, N, Escape or Ctrl-C cancels.
|
||||||
|
|
@ -301,9 +327,11 @@ are passed through as 24-bit SGR when COLORTERM is truecolor or 24bit and TERM
|
||||||
does not start with screen, tmux, linux, or dumb; otherwise RGB is mapped to
|
does not start with screen, tmux, linux, or dumb; otherwise RGB is mapped to
|
||||||
the nearest xterm-256 entry.
|
the nearest xterm-256 entry.
|
||||||
.SH SESSION SIZE
|
.SH SESSION SIZE
|
||||||
The most recently attached or resized client determines the session size,
|
By default, the most recently attached or resized client determines the session
|
||||||
clamped to a minimum of 20 columns by 5 rows and a maximum of 1,000 by 1,000.
|
size, clamped to a minimum of 20 columns by 5 rows and a maximum of 1,000 by
|
||||||
Larger clients center the session; smaller clients show its top-left portion.
|
1,000. With the \-\-resize\-on\-input option or the Configuration menu toggle,
|
||||||
|
the client that most recently sent input determines the size instead;
|
||||||
|
attaching and resizing are only used before any client has sent input.
|
||||||
Ctrl-A R forces the session to the current client's terminal size.
|
Ctrl-A R forces the session to the current client's terminal size.
|
||||||
Ctrl-A * lists attached clients for size diagnostics.
|
Ctrl-A * lists attached clients for size diagnostics.
|
||||||
.PP
|
.PP
|
||||||
|
|
@ -317,7 +345,9 @@ assume --hostname is enabled.
|
||||||
SSH does not expose remote foreground programs or working directories locally.
|
SSH does not expose remote foreground programs or working directories locally.
|
||||||
Configure the remote shell to send terminal reports using one of the examples
|
Configure the remote shell to send terminal reports using one of the examples
|
||||||
below. Reload the shell configuration or open a new SSH shell afterward.
|
below. Reload the shell configuration or open a new SSH shell afterward.
|
||||||
Restart session servers after upgrading murx to gain newly added features.
|
Sessions started by a handoff-capable build can move to a new binary with
|
||||||
|
.BR "murx \-\-adopt [" session "]";
|
||||||
|
older session servers still need a restart after upgrading.
|
||||||
.PP
|
.PP
|
||||||
OSC 0 or OSC 2 titles of the form hostname:program update the SSH window name.
|
OSC 0 or OSC 2 titles of the form hostname:program update the SSH window name.
|
||||||
Use a hostname containing only letters, digits, dots, underscores or hyphens,
|
Use a hostname containing only letters, digits, dots, underscores or hyphens,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue