Rex multiplexer client for Emacs, built on Ghostel.
Rex is a terminal multiplexer: shells run in sessions on a Rex server and keep running while no client is attached, as in tmux. Rexel is a Rex client for Emacs. Each terminal of a session becomes a ghostel buffer with a full terminal emulator, so typing, scrollback, search and copy mode work as in a local terminal, and the shell keeps running on the server when Emacs goes away.
The server can be this machine, or a remote one reached over Tailscale or an ssh tunnel. Rex.app, or any other Rex client, can be attached to the same session at the same time.
- Attach to running sessions, create new ones, split and open tabs from Emacs.
M-x rexelandM-x rexel-projectin place ofM-x ghostelandM-x ghostel-project: a session per project, a tab per terminal.- Survives dropped connections, sleep and network changes.
- Drop or paste files onto a terminal to send them to the server’s machine, and copy files from there.
- Forward a port of the server’s machine, such as a development server’s, and open links to localhost through the forward; or forward a port of this machine to the server’s.
- Directory tracking and command state from the processes Rex reports.
- Your ghostel key bindings and settings apply in every block buffer.
- Optional pickers with previews and Embark actions, see Consult and Embark.
You need a Rex server (on macOS the Rex Beta app includes one) and, from MELPA, ghostel and websocket. Rexel itself is not on MELPA yet; on Emacs 30 and later:
(use-package rexel
:vc (:url "https://github.com/dakra/rexel"
:lisp-dir "lisp")
;; Session and block commands from any buffer
:bind-keymap ("C-c C-r" . rexel-prefix-map)
:custom
;; Show a session's focused block instead of asking what to show
(rexel-attach-display 'focused)
;; In a project, M-x rexel uses the project's session
(rexel-default-session-function #'rexel-project-session-label)
;; A remote server, over Tailscale or an ssh tunnel to its socket
(rexel-hosts '(("studio" "rex.tail1234.ts.net" "/tmp/studio.sock"))))Only the :vc line is needed. The others make the session and block
commands available everywhere under C-c C-r (in a block buffer they are
there anyway), skip the question which block of a session to show, make
M-x rexel use the session of a project, and name a remote server;
this machine’s server is found on its own. See Servers for Tailscale
and ssh.
:lisp-dir "lisp" is only required on Emacs < 31.1. On Emacs 29, evaluate
(package-vc-install '(rexel :url "https://github.com/dakra/rexel" :lisp-dir "lisp"));
on Emacs 28, clone the repository and add its lisp directory to load-path.
Then M-x rexel shows a shell in a Rex session of its own, M-x
rexel-new-session starts a shell in a new session and M-x rexel-attach
picks a running one. With no Rex server running, rexel offers to start
one.
M-x rexel-new-sessionopens a shell in the buffer*rex:SESSION:1*, in the current directory.C-c C-r 3splits it to the right with a second shell in the same directory;C-c C-r copens a new tab.- A file dropped on the buffer is sent to the server’s machine and its path typed into the terminal.
C-c C-r ddetaches: the buffers go, the shells keep running.- Later, or from another Emacs,
M-x rexel-attachbrings the session back with its scrollback, andC-c C-r =lays out the tab’s blocks in the frame’s windows.
The rest of this document covers each part in detail.
- Rex 0.1.0-preview.20 or later, for macOS, Linux or FreeBSD. On macOS it
comes with the Rex Beta app, which need not run; rexel looks for
rexel-programonexec-path, then for the copy inside the app. The app does not putrexonPATH; for use in a shell, symlink it:ln -s "/Applications/Rex Beta.app/Contents/Helpers/Rex Server.rex/Contents/MacOS/rex" /usr/local/bin/rex - A Rex server.
M-x rexel-start-serverrunsrex server starton this machine. With no server known, rexel offers to do that; setrexel-autostart-servertotto skip the question ornilto never start one. With systemd,systemctl --user enable --now rex.socketstarts your own server on demand instead. - Ghostel 0.66.0 or later, with its native module.
- websocket 1.15 or later.
- Emacs 28.1 or later with native JSON support (
json-serialize): built in since Emacs 30, libjansson on 28 and 29. - For
consult-rexel, consult 1.5 or later. It uses Embark andconsult-ghostelwhen they are installed.
M-x rexel-attach and M-x rexel-new-session ask for a server when more
than one is known. Servers are this machine’s (from rex server status),
the hosts known to Rex (rex hosts) and rexel-hosts.
A remote server is reached over Tailscale, which is built into Rex. On
the server, rex server tailscale on joins it to your tailnet as a device
of its own; rex server status shows the sign-in link and then the
server’s address. rex server start --tailscale keeps it on across
restarts. This machine needs Tailscale running under the same account.
Then add the host, which Rex and rexel both use:
rex hosts add studio rex.tail1234.ts.netWithout Tailscale, forward the server’s socket over ssh. For a Linux server, with your user id on it in the path:
ssh -N -o StreamLocalBindUnlink=yes \
-L /tmp/devbox.sock:/run/user/1000/rex/server.sock devbox
rex hosts add devbox unix:///tmp/devbox.sockssh devbox rex server status prints the socket of a running server. A
shared Linux server is at /run/rex/server.sock and a macOS one at
~/Library/Application Support/rex/server.sock.
Name the servers in rexel-hosts instead:
(setq rexel-hosts
'(("studio" . "rex.tail1234.ts.net")
("devbox" . "/tmp/devbox.sock")
;; Tried in order; a redial starts with the one that last answered
("laptop" "rex.tail5678.ts.net" "http://192.168.1.20:7297")))An address without a scheme is reached over https only; http://HOST:PORT
names a plain listener. A host alone, without port or path, is tried on
its scheme’s port, then on Rex’s port 7297. An entry replaces a host of
the same label known to Rex. Buffers of a host are named
*rex:SESSION@HOST:TAB*.
M-x rexel-attach lists a server’s sessions and opens one ghostel buffer
per terminal block. For a session of several blocks it then asks what to
show: a block, named after its tab and the program and directory running
in it, with the focused one first, or a tab’s layout. A block pops up and
leaves your windows as they are; the layout of a tab with a split rebuilds
the frame’s windows from it, as rexel-sync-layout does.
rexel-attach-display set to focused shows the focused block without
asking, and layout the active tab’s layout; C-u M-x rexel-attach asks
whatever it is set to.
A block buffer is named *rex:SESSION:TAB*, after its session and the
label of its tab, or the tab’s number when it has no label. The other
blocks of a split tab are TAB.2, TAB.3 and so on. A tab and a block
keep their numbers: closing a tab leaves the buffers of the others as they
are named, and a new tab takes the lowest number left.
rexel-buffer-name-function names the buffers. It is called in a block
buffer with the TAB part of the name, when that part, the session’s label
or the terminal’s title or directory changes:
;; Name a block buffer after its session, its tab and the terminal's title.
(setq rexel-buffer-name-function
(lambda (tab)
(format "*rex:%s:%s %s*" (rexel-session-label) tab (or ghostel-title ""))))A buffer renamed by hand keeps its name. ghostel-buffer-name-function
does not apply to block buffers.
M-x rexel-new-session creates a session with one shell and attaches to
it, asking for its label with a prefix argument. On this machine’s server
the shell starts in default-directory, elsewhere in the home directory.
rexel-session-label-function rewrites the label of every new session.
Killing a block buffer closes its block and ends the program in it, after
a confirmation when the block runs a command. With
rexel-kill-buffer-action set to keep the block keeps running, and ask
asks each time. This holds for every kill, also one by
project-kill-buffers or clean-buffer-list. C-c C-r d detaches from the
whole session and leaves it running. Exiting Emacs closes no block: the
sessions keep running, and the server takes Emacs off them at once.
An attached session whose last block closes is destroyed, whatever closes
the block: a killed buffer, C-c C-r x, a shell that exits, or another Rex
client. With rexel-destroy-empty-sessions set to nil it stays on the
server, empty.
M-x rexel is to Rex what M-x ghostel is to a local terminal. It shows
the session labelled emacs (rexel-default-session) on this machine’s
server, in the selected window, and creates it with a shell in
default-directory when the server has none. In a TRAMP directory the
server is another, see Other machines, and in a project the session can
be the project’s, see Projects. A terminal is a tab of that session:
| Command | Shows |
|---|---|
M-x rexel | the block you selected last, else the focused one |
C-u M-x rexel | a new tab, its shell in default-directory |
C-u 2 M-x rexel | tab 2, or a new tab when the session has no tab 2 |
The session outlives Emacs, so after a restart M-x rexel is back in the
shells you left. A session without a block left gets a new tab.
rexel-project, in rexel-project.el, does the same with one session per
project, labelled with the project’s name:
(use-package rexel-project
:bind (:map project-prefix-map
("r" . rexel-project)
("R" . rexel-project-new)
;; In place of project-kill-buffers
("k" . rexel-project-kill))
:config
(add-to-list 'project-switch-commands '(rexel-project "Rexel") t))M-x rexel-projectshows the project’s session and creates it with a shell in the project’s root. It takes the prefix arguments ofM-x rexel.M-x rexel-project-newopens another tab at the project’s root.M-x rexel-project-killrunsproject-kill-buffers, which asks first, and then destroys the project’s session with its programs, also when this Emacs is not attached to it. A session with blocks that run a command asks first, and so does a project without buffers to kill. No server is started for it.
The session is found by its label, so two projects of one name share a
session, and a session renamed in another client is no longer the
project’s. The name is the one project.el gives the project;
project-vc-name, set in .dir-locals.el, changes it.
M-x rexel uses the project’s session as well with
(setq rexel-default-session-function #'rexel-project-session-label)In a buffer of a project it then shows that project’s session, and the
emacs session elsewhere. Its shells still start in default-directory,
and C-u C-u M-x rexel opens a tab in the emacs session from a project
too; rexel-project takes it as C-u. In a TRAMP directory the project is
found only while TRAMP is connected to its machine.
In a TRAMP directory M-x rexel and the project commands use the Rex
server of that machine:
a project at /ssh:studio:/srv/app/ has its session on the server
labelled studio, or whose address names the host studio, and its shell
starts in /srv/app there. A machine without a known server is an error,
and a TRAMP directory on this machine, as under /sudo::, uses this
machine’s server. rexel-tramp-hosts names the server for a TRAMP prefix
that neither matches:
(setq rexel-tramp-hosts '(("devbox" . "/ssh:[email protected]:")))The buffers of such a server’s blocks follow their shells’ directories
under the prefix, so find-file in one starts there.
project-kill-buffers itself leaves the sessions alone: by default it
kills no ghostel buffer. Ghostel’s README has the condition that makes
it kill them, which closes the blocks of a project, and its session goes
with the last of them.
In a block buffer C-c C-r (rexel-prefix-key) prefixes:
| Key | Command |
|---|---|
3 | rexel-split-right |
2 | rexel-split-below |
| arrow keys | split to that side, e.g. rexel-split-left |
RET | rexel-split, below or right, where it fits |
c | rexel-new-tab |
a | rexel-attach |
n | rexel-new-session |
= | rexel-sync-layout, see Layout and size |
$ | rexel-rename-session |
u | rexel-upload-file, see Uploading files |
f | rexel-port-forward, see Forwarding ports |
F | rexel-port-forward-reverse |
x | rexel-close-block, ends the program |
d | rexel-detach, keeps the session running |
Each key works with Control held too: C-c C-r C-d detaches like
C-c C-r d. Some terminals send no Control variant of 2, 3, =, $ or
RET, and send the one of F as that of f.
A split or tab’s shell starts in the directory of the current block’s shell.
The map is rexel-prefix-map. Bound globally, as in the Quick start,
its a, n and = work in any buffer and u in Dired, where it sends the
marked files to a block buffer you pick; the other commands need a block
buffer. Modes that bind C-c C-r themselves, such as Org, Python and
Magit, keep it. To move the prefix in block buffers, customize
rexel-prefix-key:
(setopt rexel-prefix-key "C-c b")All other keys behave as in any ghostel buffer.
Emacs windows are not kept in step with the Rex layout. rexel-sync-layout
rebuilds the selected frame’s windows from the current block’s Rex tab,
with C-u from a tab picked by label; outside a block buffer it asks for an
attached session and uses its active tab. Only the tab’s tiled layout is
rebuilt: a block floating above it is an ordinary buffer to switch to,
marked floating or minimized when rexel-attach lists it, and a tab of
floating blocks alone shows its focused one. Rex’s zoom is not mirrored;
C-x 1 on a block does the same here.
Emacs takes ownership of a block when a window starts showing it or its
stream reconnects, so the terminal is sized to the smallest Emacs window
showing it, as a tmux client would. A window that starts showing a block
while you are in the minibuffer, as the preview of a buffer picker does,
takes it only if it still shows it once the minibuffer exits. Another client such as Rex.app can
take the block back; the terminal then follows that client’s size until
Emacs takes it again. With the keyboard focus Emacs does so for the block
in the selected window: when you select that window, when it changes size,
and when the frame gets the focus. A terminal that does not report its
focus counts as focused. While another client sizes the block, its mode
line reads [Sized by another client 183x138] with the size that client
gave it, and mouse-1 on that takes the block too. The notice is part of
mode-line-misc-info.
Block buffers are ghostel buffers, so the buffer pickers list them.
consult-rexel, in extensions/consult-rexel/, adds pickers of its own on
top of consult:
(use-package consult-rexel
:vc (:url "https://github.com/dakra/rexel"
:lisp-dir "extensions/consult-rexel")
:hook (after-init . consult-rexel-mode)
:bind (("C-x m" . consult-rexel)
:map project-prefix-map
("r" . consult-rexel-project)
:map rexel-prefix-map
("r" . consult-rexel)
("t" . consult-rexel-tab))
:config
(add-to-list 'project-switch-commands '(consult-rexel-project "Rexel") t))The mode loads rexel and consult when Emacs starts. consult-rexel and
consult-rexel-tab are then also on C-c C-r r and C-c C-r t: in a block
buffer, and everywhere with the :bind-keymap line of the Quick start.
M-x consult-rexellists the block buffers, grouped by session, and below them the other sessions of the connected servers. In a project on this machine its session comes first. A block is previewed as its buffer, and a session by the end of the text in its focused block, without attaching to it. A session shows the program status of its terminals as a block buffer does. Choosing a session attaches it asrexel-attachdoes. A name that matches nothing opens a tab with that label in the session ofM-x rexel, and the New group offers such a tab and a new session. Without a connection it connects to a server first. Listing the sessions subscribes the connection to the session events of the whole server. With a prefix argument it isrexel.M-x consult-rexel-projectlists the blocks of the current project’s session, which it attaches to first. A name that matches nothing opens a tab with that label in it, and creates the session when the server has none. With a prefix argument it isrexel-project.- With
consult-ghostelinstalled both list whatconsult-ghostelandconsult-ghostel-projectlist as well, so they can take the place of those commands. Each Rex block is listed once, under its session, andconsult-rexel-projectlists the blocks of no other session. The narrow keyrshows the Rex groups alone.consult-rexel-sourcesandconsult-rexel-project-sourceshold the sources. M-x consult-rexel-tabpicks a tab of a session and rebuilds the frame’s windows from it, previewing each layout in the selected window.consult-rexel-modeadds the blocks toconsult-ghostelandconsult-bufferas a hidden source. The narrow keyrshows it alone, as inconsult-rexel; inconsult-buffer, wherershows the registers, the key isx. The mode also gives the prompts ofrexel-attachandC-u M-x rexel-sync-layoutthe same previews of blocks and layouts.
With Embark installed the mode also adds actions. On a buffer, in any
buffer prompt, R (consult-rexel-embark-key) prefixes the actions on a
Rex block: R d detaches its session, R x closes the block and R $
renames the session, the keys of C-c C-r. On a session in
consult-rexel, a attaches, d detaches, $ renames and k destroys it.
A file dropped on a block buffer, or an image pasted with M-x yank-media,
goes to the program in the block: Rexel sends the file to the server’s
machine and Rex types its path into the terminal, as a paste. This is how
to hand a screenshot to a coding agent running in a remote block, for
example.
rexel-upload-file (C-c C-r u) does the same for a file read from the
minibuffer. In a Dired buffer it sends the marked files to a block buffer
you pick. Files on a TRAMP host are fetched first, which Emacs waits for
and which cannot be cancelled.
Files sent together have their paths typed together, in order, once all
have arrived. The server keeps them until the block closes. It takes
files of up to 100 MiB, 16 at a time; more than 16 go in rounds. Emacs
stays usable while a file is sent and rexel-cancel-upload stops it. While a
connection stalls Emacs waits, and gives the upload up after ten seconds; each
stalled connection can take that long in turn, one carrying a large paste
longer. A cancelled upload, or one whose connection drops or stalls, types
nothing and is not resumed.
The exception is this machine’s server: a local file is not copied, and Rexel types its own path.
M-x rexel-download-file in a block buffer copies a file from the block’s
machine to this one. It reads the file’s path there and where to save it;
a directory gets a file of the same name. The path is read as find-file
reads one, with completion of the files there, starting in the directory
of the program in the block’s foreground; M-n inserts the file name at
point. A relative path is one in that directory, and ~ is the home
directory there. With a prefix argument the copy is visited once it has
arrived.
Emacs stays usable meanwhile. rexel-cancel-download in the block’s
buffer stops its downloads, as does killing the buffer. The copy
collects in a .part file beside it and appears under its name only when
it is complete, with the permissions of a file it replaces. A cancelled
download, or one whose connection drops, leaves nothing behind and is
not resumed.
rexel-port-forward (C-c C-r f) forwards a port that a program in a
block of another machine’s server listens on: Rexel listens on a port of
this machine and relays each connection through the server to the block’s
machine. A block that listens on one port has that port
forwarded, and with several the command reads one of them. Without any,
or with a prefix argument, it reads a port, a host:port the server
reaches, or a URL. The URL of the local port is shown and put in the
kill ring.
The forward listens on the same port of this machine, so that
http://localhost:5173/ stays that, or on a free one when that port is
taken. It listens on 127.0.0.1 only.
A link to localhost in such a block opens through a forward of its port,
which is made when needed; rexel-port-forward-links turns that off.
When a program in a block starts to listen on a port, the echo area names
it. With rexel-port-forward-new-ports set to t the port is forwarded
at once, and with nil nothing happens. This holds for ports opened
while Rexel is attached to the session.
When the block stops listening on a forwarded port, the forward closes,
and it opens again on the same local port once the block listens on the
port again, as after a restart of a development server.
rexel-port-forward-when-port-closes can be close, which leaves it
closed, or keep, which leaves it open. The server sees the ports of
the programs running in the block’s terminal: on macOS not those of a
daemon that left the terminal or of a program inside tmux. A forward to
such a port, or to another host, stays until
M-x rexel-port-forward-close, which reads one of the open forwards, or
until its block closes or the session is detached.
rexel-port-forward-reverse (C-c C-r F) forwards the other way. It
reads a port of this machine, a host:port this machine reaches, or a
URL, and the block’s server listens on the same port of its machine, or
on one it picks when that port is taken. Emacs relays each connection
to that port to the target. The server listens on 127.0.0.1 only, where
every user and program of its machine reaches the port. The port’s URL
there is shown and put in the kill ring. It stays until
M-x rexel-port-forward-close, the end of its block or a detach.
A connection whose program on this machine ends its sending side, as
nc does at the end of its input, is closed as a whole; what the other
side still sends is lost. Browsers and curl keep theirs open. So it
is with the target of a reverse forward that ends its sending side
before the program on the server’s machine has sent everything. While
a program on this machine takes what a forward delivers more slowly than
it arrives, Emacs waits for it, and gives the connection up after ten
seconds without progress.
On this machine’s server a block’s ports are local already and nothing is forwarded.
The Rex server starts the shell of a block, so ghostel cannot inject its
shell integration. Rexel reads the processes Rex reports instead:
default-directory follows the shell’s working directory on this machine’s
server and on one with a TRAMP prefix (see Other machines),
and ghostel-command-running-p knows when a command runs. Rex
reports process changes with some delay, so a command that finishes within
a moment can go unseen.
Prompt navigation (C-c M-n / C-c M-p), exact command boundaries and
ghostel cmd need the shell to emit ghostel’s escape sequences. Rex sets
TERM_PROGRAM=rex, so source the integration on that too:
# ~/.bashrc
if [[ "${INSIDE_EMACS%%,*}" = ghostel || "$TERM_PROGRAM" = rex ]]; then
source /path/to/ghostel/etc/shell/ghostel.bash
fi
# ~/.zshrc
if [[ "${${INSIDE_EMACS-}%%,*}" = ghostel || "$TERM_PROGRAM" = rex ]]; then
source /path/to/ghostel/etc/shell/ghostel.zsh
fi
# ~/.config/fish/config.fish
if string match -qr '^ghostel(,|$)' -- "$INSIDE_EMACS"; or test "$TERM_PROGRAM" = rex
source /path/to/ghostel/etc/shell/ghostel.fish
endNushell emits OSC 7 and 133 itself; see ghostel’s README for its
ghostel.nu. Sourcing the scripts is harmless when the block is shown in
Rex.app, which uses the directory report and ignores the rest.
A shell on another machine needs the integration there. From a block
whose shell sources ghostel’s script as above, ghostel ssh HOST pushes
the integration to HOST and loads it for that session, without touching
HOST’s rc files. ghostel ssh-install HOST hooks HOST’s rc files
instead, so that a plain ssh HOST loads it too; see “Remote shell
integration” in ghostel’s README.
That hook recognizes a Rex terminal by TERM=xterm-rex. Rex gives its
terminals that name once rex terminfo setup has run, and ssh passes it
on only to hosts recorded with rex terminfo host install HOST, which
installs Rex’s terminfo entry there; other hosts receive
xterm-256color. rex terminfo status shows what a new terminal gets.
A package finds the block buffers, and what each of them shows, with the
functions below. BUFFER is a block buffer, by default the current buffer;
for any other buffer they return nil.
| Function | Returns |
|---|---|
(rexel-block-p BUFFER) | Non-nil if BUFFER shows a block, also while it is disconnected. |
(rexel-block-id BUFFER) | The block’s ID, such as "block:<uuid>". |
(rexel-session-id BUFFER) | The ID of the block’s session, such as "session:<uuid>". |
(rexel-session-label BUFFER) | The session’s label, nil without a server connection. |
(rexel-host BUFFER) | The label of the block’s server, as in rexel-hosts or Rex’s own list; nil for the server found on this machine without either, and without a server connection. |
(rexel-block-live-p BUFFER) | Non-nil while the terminal has the block’s content and its output. |
(rexel-block-buffers) | The block buffers, most recently selected first. |
(rexel-block-buffer BLOCK-ID) | The buffer of a block; of several, as for a server attached to at two addresses, the most recently selected. |
A block buffer is a ghostel buffer: ghostel-send-string in it types into
the block and ghostel-paste-string pastes, and (rexel-upload-file FILES
BUFFER) sends files to it. These go through the server’s control
connection, which rexel-block-live-p says nothing about: while it is
redialled, what is typed waits and an upload fails.
rexel-block-mode-hook runs in a new block buffer before its terminal has
the block’s content, and again when a block whose stream ended is streamed
into its buffer anew; an error in one of its functions is shown as a
message. A block that closes has its buffer killed, as have
the blocks of a session that is detached or destroyed (kill-buffer-hook).
;; The live terminals of the session the current block is in.
(when-let* ((session (rexel-session-id)))
(seq-filter (lambda (buffer)
(and (equal (rexel-session-id buffer) session)
(rexel-block-live-p buffer)))
(rexel-block-buffers)))| Option | Default | Meaning |
|---|---|---|
rexel-hosts | nil | Servers besides those rex knows, see Servers |
rexel-attach-display | ask | What rexel-attach shows: ask, focused or layout |
rexel-default-session | "emacs" | Label of the session M-x rexel shows |
rexel-default-session-function | nil | Names the session of M-x rexel for a buffer |
rexel-tramp-hosts | nil | TRAMP prefixes of servers’ machines, by server label |
rexel-session-label-function | nil | Rewrites the label given to rexel-new-session |
rexel-buffer-name-function | rexel-buffer-name-by-tab | Names a block buffer, see Sessions |
rexel-kill-buffer-action | close | What killing a block buffer does: close, keep or ask |
rexel-destroy-empty-sessions | t | Destroy a session when its last block closes |
rexel-port-forward-new-ports | message | A block’s new port: message, t to forward it or nil |
rexel-port-forward-when-port-closes | remember | A forward whose port closed: remember, close or keep |
rexel-port-forward-links | t | Open links to localhost through a forward |
rexel-prefix-key | "C-c C-r" | Prefix for rexel-prefix-map in block buffers |
rexel-autostart-server | ask | Start a local server when none is found: ask, t or nil |
rexel-program | "rex" | The Rex command-line program |
Block buffers run rexel-block-mode, whose hook rexel-block-mode-hook runs
in each new one.
Attaching, typing, resizing, uploads, downloads, port forwards and the basic layout commands work.
A dropped data connection resumes its stream, and a lost control connection is redialled with backoff while sessions are attached; typing meanwhile is sent once it is back, but keys on their way when the connection dropped may be lost. A connection that stays silent is pinged and counts as dropped when the server does not answer, so a link left dead by a sleep or a network change recovers too.
Rex streams each terminal to its clients as a libghostty snapshot followed by the raw PTY bytes. Ghostel runs libghostty, so Rexel feeds that stream straight into a ghostel buffer’s terminal engine instead of emulating a terminal of its own; keystrokes travel back over Rex’s control API. Both connections are WebSockets, on the server’s Unix socket or its network address.
- Ghostel, the terminal Rexel is built on.
- ghostel-tmux, the same idea for tmux, through its control mode.
make byte-compiles, runs the tests and lints, consult-rexel included. The tests cover what runs
without a server. test/elate/run.sh drives rexel in a sandboxed Emacs
against this machine’s Rex server; see test/elate/README.md.