diff --git a/APKBUILD b/APKBUILD index 4d3ea24..c7223c4 100644 --- a/APKBUILD +++ b/APKBUILD @@ -1,6 +1,6 @@ -# Local source snapshot; refresh checksums with `abuild checksum` after edits. +# Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=0.20261116 +pkgver=1.0 pkgrel=0 pkgdesc="Small persistent terminal multiplexer" url="https://codeberg.org/armin/murx" @@ -26,10 +26,10 @@ package() { } sha512sums=" -95b73a9ce945da4071f60007a5c57f288b68e0677b05f8a4ffc8c0a10940e5ed57e9df1840e6ce2741d471e15375cfb5a4a09edade51c6b4866160a3c507cd73 murx.c -ca73b902d64fc9dc52d8d14b6c8ca6b494f4bea3f3602c29fd2909252668e110edff075c881e014e689d7c7d990dee2a4a96208276bae50243ca382adc5ead80 Makefile -db9fe919bac2b4976efa6d760b1f917ec6fee88a4f2811ea4ac69334f6f24d522569c2cd3c3d087eb43cace659bf4c00f3c4097cc901d769b4e4000342d65c45 murx.1 -153e4c4d23e64b74119714790c3701cc3cb2883494237fb44974efb9fc95a9adbc9a3425b1ed93d6e14014d8b3861e08ce2ef658093cd3ea151d9cf9fdada07f README.md +0a40b60d95effbf69c8a0904c2031260d8398d9a0fc8f91fc45e260d655d240f6ef0cadaf0d1324b420da7031e43ed13325559d0b9026a4fba9a4eef481ecbbe murx.c +ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile +c79bb8fc5c00b9ed784a3221e33a9a341ad4ce5b9880585409cce8e068a1e8be1ecb77115784cca0247250870069e3d63b23833857e5e9c5ab3e8da4c036eb4f murx.1 +c8a4f7661af194b2b5d04edb90b6d4d87838711d59d12039bc8adaf84c724d311301aad0e2e1ced69719b491b910c0bbb01e610b508348cd6c860bd2c3a0723c README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/Makefile b/Makefile index 3f28aa6..44ec907 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,16 @@ pkgarch: pkgclean makepkg pkgsums: + @version=$$(sed -n 's/^#define MURX_VERSION "\([^"]*\)"$$/\1/p' murx.c); \ + if [ -z "$$version" ]; then \ + echo "Could not read MURX_VERSION from murx.c" >&2; exit 1; \ + fi; \ + tmp=$$(mktemp .pkgsums.XXXXXX) || exit 1; \ + trap 'rm -f "$$tmp"' 0; \ + for recipe in APKBUILD PKGBUILD; do \ + sed "s/^pkgver=.*/pkgver=$$version/" "$$recipe" > "$$tmp" && \ + cat "$$tmp" > "$$recipe" || exit 1; \ + done abuild checksum updpkgsums diff --git a/PKGBUILD b/PKGBUILD index 8dbf3f5..1c0115e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ -# Local source snapshot; refresh checksums with `updpkgsums` after edits. +# Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=0.20261116 +pkgver=1.0 pkgrel=1 pkgdesc='Small persistent terminal multiplexer' arch=('x86_64' 'aarch64') @@ -8,10 +8,10 @@ url='https://codeberg.org/armin/murx' license=('Apache-2.0') depends=('glibc') source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS') -sha256sums=('ef7a6d215ec78876a7eb850eae5bb554011c4e12b4f0607f57d9195d9e2ba821' - 'c683ed74c664ebb2a72603297367ed102afdf27e4d6cee47920db8632a8efa91' - 'd2219b9be02a6d588c593eb001c2c7f1ada845c4c72fa5837937d08192572678' - '7b47bf380ba9c9c5defede500514fba6527c8202e64d8f9f622c09de7c5610e8' +sha256sums=('dc7eea9afcc33209d52a0a0a9f654444ece16a122127ffae8ac7f19942521908' + '4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2' + '9788331168223850709fc3c6cda9c9ab4563ff0ee4e58b992d7c2d24e02bb695' + '4f6f36d91e4363f37d9b72b506198658619550a93ec07f122a26d009846e3a7f' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') diff --git a/README.md b/README.md index a43356b..9c64f0c 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ make ./murx -c 191a1c work # use a grey status bar background ./murx --clock work # show the status bar clock ./murx --hostname work # show the hostname: prefix in window titles -./murx -l # list running sessions (or --list-sessions) -./murx --help # all shortcuts +./murx -l, --list-sessions # list running sessions without attaching +./murx --help # version, usage and all shortcuts +./murx -v, --version # print the version and exit ``` Detach with `Ctrl-A d`. Run `murx` again to reattach. @@ -94,6 +95,7 @@ and `murx-root`. - Application cursor-key mode follows the active pane, so arrow navigation works in programs such as Midnight Commander. Menus and prompts use normal cursor-key mode; detaching restores normal cursor keys in the outer terminal. +- Home (Pos1) and End use the pane’s `screen-256color` key sequences. - Multiple clients can attach to the same session. The most recently attached or resized client sets the session size; a larger client shows the session centred in its terminal, while a smaller client shows the top-left part. @@ -435,11 +437,11 @@ that otherwise collapses pane grids to 1x1. The root directory includes [APKBUILD](APKBUILD) for Alpine Linux and [PKGBUILD](PKGBUILD) for Arch Linux. Both build the local source files rather -than downloading a release. Version `0.20261116` identifies an unreleased -snapshot; update the version and release fields when packaging a newer snapshot. -Both recipes build with the default C compiler and pass distro `CFLAGS` to -`make`. The packages install under `/usr`, including the manual, README, -AUTHORS and license. +than downloading a release. The package version comes from `MURX_VERSION` in +`murx.c`; adjust the package release fields separately as needed. Both recipes +build with the default C compiler and pass distro `CFLAGS` to `make`. The +packages install under `/usr`, including the manual, README, AUTHORS and +license. On Alpine, install `alpine-sdk`, configure your abuild signing key with `abuild-keygen -a -i`, and run as a regular user with abuild configured: @@ -462,9 +464,9 @@ makepkg -si This builds the package and installs it through pacman. The recipe lists `x86_64` and `aarch64`; builds run on the current architecture. -After changing any packaged source file (`murx.c`, `Makefile`, `murx.1`, -`README.md`, `LICENSE` or `AUTHORS`), refresh recipe checksums with `abuild checksum` -on Alpine and `updpkgsums` (from `pacman-contrib`) on Arch. Neither recipe +After changing a packaged source file, run `make pkgsums` to sync both package +versions and refresh both sets of checksums. This target requires `abuild` +and `updpkgsums` (from `pacman-contrib`). Neither recipe requires a test suite; its check step runs `murx --help` as a smoke check. ## Authors diff --git a/RELEASES.md b/RELEASES.md new file mode 100644 index 0000000..16724e9 --- /dev/null +++ b/RELEASES.md @@ -0,0 +1,34 @@ +# murx 1.0 released + +**November 21, 2026** — murx has reached 1.0. It is a deliberately small terminal multiplexer: one C99 source file, no config file, no dependencies, and no scripting layer. Build it with `make`, run `./murx`, and detach with `Ctrl-A d`. + +## What you get + +- Persistent named sessions, each with its own small server and Unix socket. Programs keep running when you detach. +- Windows, split panes, resizing, renaming, scrollback and a configurable status line. +- Multiple clients attached to one session, each with its own prefix, scrollback position and lock state. +- Real ptys with a built-in terminal emulator: colors, 256-color and truecolor, UTF-8, wide characters, alternate screen and 2,000 lines of history per pane. +- Optional per-client prefix (`-p x`), status line position (`-s top|bottom`), status bar background (`-c RRGGBB`), clock, hostname and current-directory display. +- Optional SSH shell hooks for remote window names, directory reporting and root-shell highlighting. +- Linux, macOS, FreeBSD and OpenBSD support, plus an `APKBUILD` and `PKGBUILD` for packaging. + +## Highlights since the early releases + +The project was renamed from moerx to murx, gained a manual page and `Apache-2.0` license, and now ships a manpage, package recipes and install/uninstall targets. Session listing via `murx -l`, status bar colors, scrollback-mode window switching, fixed Home/End handling and `murx -v` / `murx --version` are all part of this release. + +Navigation was also tightened: `Ctrl-A h/j/k/l` and the arrow keys now pick the pane truly in the requested direction, preferring overlapping panes, and terminal resizing is reconciled every 250 ms in addition to `SIGWINCH`. + +## Upgrading + +If you are coming from moerx, update aliases and scripts to use `murx`, finish old sessions before removing the old executable, and replace the remote shell hooks with the `murx-cwd` and `murx-root` variants. Display options are now opt-in: use `murx --cwd --clock --hostname SESSION` for the older busy status bar. Restart long-running session servers once after upgrading. + +## Build and install + +```sh +make +sudo make install +``` + +Set `PREFIX`, `BINDIR`, `MANDIR` or `DESTDIR` as needed. Read `murx.1` for full option and shortcut documentation, or run `murx --help`. + +Thanks to Armin Jenewein (founder) and Johannes Findeisen (contributor). Licensed under Apache-2.0. diff --git a/murx.1 b/murx.1 index aa54b94..b80b460 100644 --- a/murx.1 +++ b/murx.1 @@ -17,6 +17,9 @@ murx \- small persistent terminal multiplexer .BR \-h " | " \-\-help .br .B murx +.BR \-v " | " \-\-version +.br +.B murx .BR \-l " | " \-\-list\-sessions .SH DESCRIPTION .B murx @@ -85,7 +88,10 @@ Show the hostname: prefix in window names and the outer terminal title. Hide the title row above each pane. Pane titles are shown by default. .TP .BR \-h ", " \-\-help -Print usage and keyboard shortcuts, then exit. +Print the program version, usage and keyboard shortcuts, then exit. +.TP +.BR \-v ", " \-\-version +Print the program version and exit. .PP Display options set a new session's values; the Configuration menu can change them in a running session. The cwd, clock, [murx] label and hostname diff --git a/murx.c b/murx.c index 0fb3d52..2cc8bb2 100644 --- a/murx.c +++ b/murx.c @@ -33,7 +33,8 @@ * One binary, no config file. Shortcuts and the interface palette have built-in defaults. * * murx [session] attach to session (default "0"), or start it - * murx -h|--help show usage and all Ctrl-A shortcut chains + * murx -h|--help show version, usage and all Ctrl-A shortcut chains + * murx -v|--version show version * * Pure C99 + POSIX (macOS / Linux / FreeBSD / OpenBSD). */ @@ -86,6 +87,7 @@ #define MURX_NOIPA #endif +#define MURX_VERSION "1.0" #define DEFAULT_PREFIX 0x01 /* client -> server */ @@ -3908,11 +3910,13 @@ static void menu_key(Client *c, Session *s, const unsigned char *buf, size_t n, static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t n) { if (n > sizeof c->in - c->inlen) n = sizeof c->in - c->inlen; - if (n == 0 && c->inlen == 1 && c->in[0] == 27 && c->escape_since && + if (n == 0 && c->escape_since && now_ms() - c->escape_since >= 100) { Scrollback *view = scrollback_current(c, s); if (view) scrollback_remove(scrollback_slot(c, view->pane)); if (c->mode == 2) c->mode = 0; /* a lone Escape closes menus */ + else if (!view && !c->prefix_pending && s->cur && s->cur->active) + pane_write(s->cur->active, c->in, c->inlen); c->prefix_pending = 0; c->inlen = 0; c->escape_since = 0; @@ -3980,8 +3984,21 @@ static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t i++; continue; } - size_t j = i; - while (j < c->inlen && c->in[j] != c->prefix) j++; + /* screen-256color describes Home and End as CSI 1~ and CSI 4~. */ + if (p[0] == 27) { + if (left == 1) break; + if (p[1] == '[' || p[1] == 'O') { + if (left == 2) break; + if (p[2] == 'H' || p[2] == 'F') { + if (s->cur && s->cur->active) + pane_write(s->cur->active, p[2] == 'H' ? "\x1b[1~" : "\x1b[4~", 4); + i += 3; + continue; + } + } + } + size_t j = i + 1; + while (j < c->inlen && c->in[j] != c->prefix && c->in[j] != 27) j++; if (s->cur && s->cur->active) pane_write(s->cur->active, c->in + i, j - i); i = j; } @@ -3989,8 +4006,9 @@ static void client_feed(Client *c, Session *s, const unsigned char *buf, size_t memmove(c->in, c->in + i, c->inlen - i); c->inlen -= i; } - if (c->inlen == 1 && c->in[0] == 27 && - (c->mode == 2 || scrollback_current(c, s) || c->prefix_pending)) { + if (c->inlen && c->in[0] == 27 && + ((!c->mode && !c->locked && !scrollback_current(c, s) && !c->prefix_pending) || + (c->inlen == 1 && (c->mode == 2 || scrollback_current(c, s) || c->prefix_pending)))) { if (!c->escape_since) c->escape_since = now_ms(); } else c->escape_since = 0; } @@ -4260,6 +4278,11 @@ static void run_server(Session *s) { } int timeout = 200; + for (Client *c = s->clients; c; c = c->next) { + if (!c->escape_since) continue; + long long remaining = 100 - (now_ms() - c->escape_since); + if (remaining < timeout) timeout = remaining > 0 ? (int)remaining : 0; + } int pr = poll(pfds, (nfds_t)idx, timeout); if (pr < 0) { int interrupted = errno == EINTR; @@ -4932,6 +4955,7 @@ static void help_row(FILE *out, const char *left, const char *right) { } static void print_help(FILE *out) { + fprintf(out, "murx %s\n\n", MURX_VERSION); fputs("usage: murx [OPTIONS] [session]\n" "\n" "Attach to a running session, starting a server if needed. The session\n" @@ -4940,6 +4964,7 @@ static void print_help(FILE *out) { "Options:\n", out); help_row(out, "-h, --help", "show this help and exit"); + help_row(out, "-v, --version", "print the version and exit"); help_row(out, "-l, --list-sessions", "list running sessions without attaching"); help_row(out, "-p, --prefix LETTER", "client prefix Ctrl-LETTER (a-z, default: a)"); help_row(out, "-s, --status POSITION", "status line: top or bottom (new sessions: top)"); @@ -5023,6 +5048,10 @@ int main(int argc, char **argv) { print_help(stdout); return 0; } + if (strcmp(option, "-v") == 0 || strcmp(option, "--version") == 0) { + puts("murx " MURX_VERSION); + return 0; + } if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) { list = 1; } else if (strcmp(option, "--cwd") == 0) {