diff --git a/AGENTS.md b/AGENTS.md index 0ee87f7..7e44d2a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,9 +29,9 @@ outside the repo for geometry/logic checks; do not leave test files behind. - Windows use a binary `Layout` tree: `L_COLS` (left/right split) or `L_ROWS` (top/bottom split), with `Layout` x/y/w/h plus a `Pane` leaf. -- `layout_apply()` assigns pane content rectangles. With pane titles shown - (default), each leaf reserves its top row for a title and sets - `pane->y = layout->y + 1`; with `--hide-pane-titles`, content fills the leaf. +- `layout_apply()` assigns pane content rectangles. With `--pane-titles`, + each leaf reserves its top row for a title and sets + `pane->y = layout->y + 1`. By default, content fills the leaf. - Splits reserve one border column/row between children. With titles shown, horizontal splits use the lower pane's title row as the separator; with titles hidden, horizontal splits draw a border row like vertical splits. diff --git a/APKBUILD b/APKBUILD index 61ccf93..6805ec5 100644 --- a/APKBUILD +++ b/APKBUILD @@ -1,6 +1,6 @@ # Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=1.0 +pkgver=1.0.2 pkgrel=0 pkgdesc="Small persistent terminal multiplexer" url="https://codeberg.org/armin/murx" @@ -26,10 +26,10 @@ package() { } sha512sums=" -5bfcb844833775aa348915f106b96f59174e39ba141b8e7a1efac86fbbbf27f1662d0b845c7d26bb08ff9175ccc7242fc32f8eca3041248cf3179c2d53402348 murx.c +275a6a517689726858f106f27a921aab726d21260b876ef7d228d62f38800dd549dbeccea680b1f9261b01dda1c72860bb147e95270d66a8aa08a7b3a2e9823e murx.c ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile -ba098e621d6aaa976cfbdbb4e892c6af4814f75c0f15bc0c59410d8be5b427721dfef17e5e17139b61c1268afa8c49a6bae857669bc1b0f115a0126daec45785 murx.1 -cf40c708e82d02eb7a1ce95a19c37df66d3cc44ea76168e0290382c49372af309022cc73d971624d95341e46ebb4aba543372a34821b1b6aedd93aa4e667050d README.md +219082e6277ee8c226cdd61a5b17d4e3c6893adf04b2f59ea84a6b6421dbd5a6d0ff38b93d8dd8ae41ed037e77252058dacadd5ff1f0c36c7c1ff95503e1e7a8 murx.1 +11c39781332eab62dc36125ed4b72df12208b73f3d9201a8a3f16b8b9c09f9e32069597f15160efd52d97609e7d322a09db7ce249361c0c84f7e22dc013e55d8 README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/PKGBUILD b/PKGBUILD index 29b6e28..acee6bb 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Local source snapshot; refresh version and checksums with `make pkgsums`. pkgname=murx -pkgver=1.0 +pkgver=1.0.2 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=('f198326902f0d6bcfab9b47110a3af6a7d4481299058794c0abda5f2ebb1a332' +sha256sums=('a13edd7ca2da2d431ecd9e8fa1a4cae0a6e99a6a074893df204a73e8b3b19fc0' '4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2' - 'fbe804fcc53a3b3e261fcf7381fe90dddfb5035b4182fbe92013a921b297f8bc' - 'e735ed91cac752e0086e7028d9946887c54a1346e6803de2bed47d8314e57b75' + '953966bfdd0b49cb26c11220e1e2bf6b5862aaa1b2d0bf002cde9d276f0ae96b' + '6411f0a1129e0436fd2b86372ac58adb6336eb4b7eacff268650d5188626e8ff' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') diff --git a/README.md b/README.md index 9c64f0c..093d0cc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # murx +murx logo + A deliberately small terminal multiplexer. One C file, no config file, no dependencies. @@ -15,8 +17,10 @@ make ./murx --cwd work # show the current directory in the status bar ./murx --murx work # show [murx] on the left of the status bar ./murx -c 191a1c work # use a grey status bar background +./murx --history 10000 work # keep up to 10,000 history lines per pane ./murx --clock work # show the status bar clock ./murx --hostname work # show the hostname: prefix in window titles +./murx --pane-titles work # show a title row above each pane ./murx -l, --list-sessions # list running sessions without attaching ./murx --help # version, usage and all shortcuts ./murx -v, --version # print the version and exit @@ -67,10 +71,10 @@ and `--clock` to show the clock on the right. Use `--murx` to show `[murx]` on the left when `--cwd` is not enabled; the directory takes precedence if both are supplied. Use `--hostname` to show the `hostname:` prefix in window names and the outer terminal title. These display options are disabled by -default. Use `--hide-pane-titles` to hide the title row above each pane; -pane titles are shown by default. These options set the initial values for a -new session; the `Configuration...` menu can change them in a running session -(see [Menu](#menu)). To restore the previous default display, use +default. Use `--pane-titles` to show the title row above each pane. These +options set the initial values for a new session. The `Configuration...` menu +can change them in a running session (see [Menu](#menu)). To restore the +previous default display, use `murx --cwd --clock --hostname session`. ## Upgrading from moerx @@ -320,7 +324,8 @@ scrollback, forced resize and kill server. `Configuration...` contains: - `Status line...` — position (top/bottom) and background (default, black `000000`, grey `191a1c`). - `Prefix...` — this client's Ctrl-key prefix, `a` through `z`. -- Toggles for the current directory, clock, `[murx]` label and hostname. +- Toggles for the current directory, clock, `[murx]` label, hostname and pane + titles. - `Reset display/status defaults`. Settings changes apply immediately. Session settings affect all attached @@ -344,8 +349,12 @@ window shortcuts to switch directly, including `Ctrl-A n`, `Ctrl-A p`, chooser. Use `Ctrl-A c` to create a window while browsing. Returning to a window restores its scrollback view and position. -Each pane keeps up to 2,000 lines of normal screen history. The view is frozen -while browsing; programs keep running and new output continues to be saved. +Each pane keeps up to 2,000 lines of normal screen history by default. +Use `murx --history 10000 work` when creating a session to keep up to 10,000 +lines per pane. The limit accepts 0 to 100,000 lines, with 0 disabling history +retention. Reattaching to a session preserves its history limit. +The view is frozen while browsing; programs keep running and new output +continues to be saved when history retention is enabled. Scrollback views are private to each client and saved per pane while attached. Alternate-screen programs such as editors do not add history; opening scrollback there shows only their current screen. History is kept in memory, @@ -377,11 +386,11 @@ Hard-coded: report root status; install them in each remote shell, including root's. A root shell that does not run the hooks cannot report its privilege change. - Pane borders are thin box-drawing lines (`─`, `│`, `┬`, `┼`, ...) in - `colour8`, drawn on the terminal's default background. By default, the row - above each pane is a title bar showing `[N: title]`: on the active pane, - brackets/numbers use `colour7`, separator `colour11`, title `colour15`; on - inactive panes, `colour8`, `colour3`, `colour12`. Use `--hide-pane-titles` - or the Configuration menu to hide title rows and give panes more space. + `colour8`, drawn on the terminal's default background. Enable title rows + with `--pane-titles` or the Configuration menu. Each title row shows + `[N: title]`. On the active pane, brackets and numbers use `colour7`, the + separator uses `colour11`, and the title uses `colour15`. Inactive panes + use `colour8`, `colour3`, and `colour12`. - Messages use `fg=colour6,bg=colour8`. - Menus use a black background with a `colour12` frame, `colour11` titles and selection, `colour14` accents and dim `colour8` hints and separators. diff --git a/RELEASES.md b/RELEASES.md index 16724e9..ef5af9e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,26 +1,71 @@ +# murx 1.0.2 released + +**November 23, 2026** + +- Use `--history 10000` to retain up to 10,000 scrollback lines per pane in a + new session. The default is 2,000 lines per pane. +- Pane titles are off by default. Use `--pane-titles` when starting a session + or toggle them in the Configuration menu. + +# murx 1.0.1 released + +**November 23, 2026** + +- Open the main menu with `Ctrl-A m` to manage windows, panes and sessions + or change display settings live. Use `Ctrl-A o` to cycle through panes. +- Hide pane titles with `--hide-pane-titles` or toggle them in the + Configuration menu. Visible titles stay anchored to their pane's top row. +- murx detects when it is launched from one of its own panes and prevents + starting or attaching to a nested session. +- Full-screen redraws avoid corruption at the last column by disabling + terminal auto-wrap while attached. Screen-style window title sequences + are consumed without printing their contents into the pane. +- Fixed the FreeBSD build by including the header that declares `openpty`. + # 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`. +**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. +- 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. +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`. +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. +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 @@ -29,6 +74,8 @@ 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`. +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. +Thanks to Armin Jenewein (founder) and Johannes Findeisen (contributor). +Licensed under Apache-2.0. diff --git a/murx.1 b/murx.1 index b80b460..97d6fa2 100644 --- a/murx.1 +++ b/murx.1 @@ -6,10 +6,12 @@ murx \- small persistent terminal multiplexer .RB [ \-p " letter"] .RB [ \-s " top|bottom"] .RB [ \-c " RRGGBB"] +.RB [ \-\-history " lines"] .RB [ \-\-cwd ] .RB [ \-\-clock ] .RB [ \-\-murx ] .RB [ \-\-hostname ] +.RB [ \-\-pane-titles ] .RB [ \-\- ] .RI [ session ] .br @@ -44,6 +46,12 @@ hyphens or underscores. Use before a name beginning with a hyphen. .SH OPTIONS .TP +.BR \-\-history " lines" +Set the maximum number of normal-screen history lines retained per pane +in a new session. Accepts 0 to 100,000, with 0 disabling history retention. +Reattaching preserves the existing session's limit. +The default is 2,000 lines per pane. +.TP .BR \-l ", " \-\-list\-sessions List running sessions for the current user, sorted by name, one per line. Checks the runtime socket directory and /tmp fallback, skips stale sockets @@ -84,8 +92,8 @@ is not enabled. The directory takes precedence if both options are supplied. .B \-\-hostname Show the hostname: prefix in window names and the outer terminal title. .TP -.B \-\-hide-pane-titles -Hide the title row above each pane. Pane titles are shown by default. +.B \-\-pane-titles +Show the title row above each pane. Pane titles are off by default. .TP .BR \-h ", " \-\-help Print the program version, usage and keyboard shortcuts, then exit. @@ -94,8 +102,8 @@ Print the program version, usage and keyboard shortcuts, then exit. 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 -options are off by default; pane titles are shown by default. +change them in a running session. The cwd, clock, [murx] label, hostname +and pane title options are off by default. To restore the previous default display, use .BR "murx \-\-cwd \-\-clock \-\-hostname session" . .SH KEY BINDINGS @@ -237,7 +245,9 @@ Ctrl-A 0 through Ctrl-A 9, a double prefix, and Ctrl-A w for the window chooser. Use Ctrl-A c to create a window while browsing. Returning to a window restores its scrollback view and position. .PP -Each pane retains up to 2,000 normal-screen history lines in memory. +Each pane retains up to 2,000 normal-screen history lines in memory by +default. Set the limit when creating a session with +.BR \-\-history . Programs keep running while the view is frozen. Scrollback views are private to each client and saved per pane while attached. Alternate-screen programs such as editors do not add history; @@ -268,11 +278,11 @@ The outer terminal title follows [murx] program, or [murx] hostname:program with --hostname. Its [murx] prefix is always present; --murx controls only the status label. Hostnames are shortened at the first dot. -By default each pane has a title row above its content showing +With \-\-pane-titles enabled, each pane has a title row above its content showing [R N: title R], where N is the pane number. Active pane titles use colour7 brackets/numbers, colour11 separator and colour15 title; inactive panes use -colour8, colour3 and colour12. Use --hide-pane-titles or the Configuration -menu to hide title rows. Splits use thin box-drawing lines in colour8. +colour8, colour3 and colour12. Toggle title rows in the Configuration menu. +Splits use thin box-drawing lines in colour8. The status uses colour12, accents colour14 and the current window colour11. The current window name turns bright red (colour9) when its active pane's foreground process is su or has effective UID 0, including programs launched diff --git a/murx.c b/murx.c index 2cc8bb2..2fd8a6e 100644 --- a/murx.c +++ b/murx.c @@ -87,7 +87,7 @@ #define MURX_NOIPA #endif -#define MURX_VERSION "1.0" +#define MURX_VERSION "1.0.2" #define DEFAULT_PREFIX 0x01 /* client -> server */ @@ -393,7 +393,8 @@ typedef enum { PS_STRING_ESC } ParseState; -#define HISTORY_LINES 2000 +#define DEFAULT_HISTORY_LINES 2000 +#define MAX_HISTORY_LINES 100000 typedef struct Pane Pane; @@ -409,7 +410,7 @@ struct Pane { Grid *grid; int on_alt; Grid *history; /* ring of rows, retaining their original widths */ - int history_start, history_count; + int history_limit, history_start, history_count; int cx, cy; int wrap_pending; @@ -551,13 +552,14 @@ static void em_scroll_up(Pane *p, int n) { if (n < 1) n = 1; if (n > p->scroll_bot - p->scroll_top + 1) n = p->scroll_bot - p->scroll_top + 1; /* Only normal full-screen scrolling contributes shell history. */ - if (!p->on_alt && p->scroll_top == 0 && p->scroll_bot == g->h - 1) { - if (!p->history) p->history = xcalloc(HISTORY_LINES, sizeof(Grid)); + if (p->history_limit > 0 && !p->on_alt && + p->scroll_top == 0 && p->scroll_bot == g->h - 1) { + if (!p->history) p->history = xcalloc(p->history_limit, sizeof(Grid)); for (int y = 0; y < n; y++) { - int slot = (p->history_start + p->history_count) % HISTORY_LINES; - if (p->history_count == HISTORY_LINES) { + int slot = (p->history_start + p->history_count) % p->history_limit; + if (p->history_count == p->history_limit) { grid_free(&p->history[slot]); - p->history_start = (p->history_start + 1) % HISTORY_LINES; + p->history_start = (p->history_start + 1) % p->history_limit; } else p->history_count++; grid_init(&p->history[slot], g->w, 1); memcpy(p->history[slot].c, &g->c[y * g->w], (size_t)g->w * sizeof(Cell)); @@ -773,7 +775,7 @@ static void em_csi(Pane *p, const char *raw, int len, unsigned char final) { if (n < 1) n = 1; p->cx = 0; /* Further blank scrolling cannot change the screen or history. */ - if (n > g->h + HISTORY_LINES) n = g->h + HISTORY_LINES; + if (n > g->h + p->history_limit) n = g->h + p->history_limit; for (int i = 0; i < n; i++) pane_lf(p); break; case 'F': @@ -1325,6 +1327,7 @@ struct Session { int status_bottom; int32_t status_bg; /* 0 uses the terminal default */ DisplayOptions display; + int history_limit; Window *windows; Window *cur, *last; int nwin; @@ -1521,14 +1524,14 @@ static void pane_free(Pane *p) { grid_free(&p->main_grid); grid_free(&p->alt_grid); if (p->history) { - for (int i = 0; i < HISTORY_LINES; i++) grid_free(&p->history[i]); + for (int i = 0; i < p->history_count; i++) grid_free(&p->history[i]); free(p->history); } free(p); } static Pane *pane_new(const char *cwd, int w, int h, const char *title, - const char *session_name) { + const char *session_name, int history_limit) { struct winsize iws; memset(&iws, 0, sizeof iws); iws.ws_col = tty_dimension(w > 0 ? w : 80); @@ -1599,6 +1602,7 @@ static Pane *pane_new(const char *cwd, int w, int h, const char *title, p->pid = pid; p->alive = 1; p->tty_fd = slave_fd; + p->history_limit = history_limit; p->cursor_visible = 1; p->pen.fg = DEFAULT_COLOR; p->pen.bg = DEFAULT_COLOR; @@ -1771,7 +1775,7 @@ static Window *window_new(Session *s, const char *name) { int pw = s->w > 0 ? s->w : 80; int ph = s->h > 1 ? s->h - 1 : 23; if (ph < 1) ph = 1; - Pane *p = pane_new(s->cwd, pw, ph, host, s->name); + Pane *p = pane_new(s->cwd, pw, ph, host, s->name, s->history_limit); if (!p) { free(w); return NULL; @@ -3057,7 +3061,7 @@ static void switch_last_window(Session *s) { static Pane *host_pane_new(Session *s, int w, int h) { char host[128]; short_hostname(host, sizeof host); - return pane_new(s->cwd, w, h, host, s->name); + return pane_new(s->cwd, w, h, host, s->name, s->history_limit); } static void split_pane(Session *s, int type) { @@ -3469,7 +3473,7 @@ static void backscroll_start(Client *c, Session *s, int page_up) { grid_free(&view->grid); grid_init(&view->grid, p->grid->w, count + p->grid->h); for (int y = 0; y < count + p->grid->h; y++) { - Grid *row = y < count ? &p->history[(p->history_start + y) % HISTORY_LINES] : p->grid; + Grid *row = y < count ? &p->history[(p->history_start + y) % p->history_limit] : p->grid; int sy = y < count ? 0 : y - count; int width = row->w < view->grid.w ? row->w : view->grid.w; memcpy(&view->grid.c[y * view->grid.w], &row->c[sy * row->w], @@ -3558,7 +3562,6 @@ static void menu_action(Client *c, Session *s, int action) { case ACT_KILL_SERVER: start_confirm(c, 2, "kill-server? (y/n) "); break; case ACT_RESET_DISPLAY: memset(&s->display, 0, sizeof s->display); - s->display.show_pane_titles = 1; s->status_bottom = 0; s->status_bg = 0; session_layout(s); @@ -4416,7 +4419,8 @@ static void server_fail(int readyfd, const char *stage, int err) { close(readyfd); } -static void server_start(const char *path, const char *name, int readyfd, const DisplayOptions *display) { +static void server_start(const char *path, const char *name, int readyfd, + const DisplayOptions *display, int history_limit) { signal(SIGPIPE, SIG_IGN); signal(SIGHUP, SIG_IGN); signal(SIGCHLD, SIG_DFL); @@ -4471,6 +4475,7 @@ static void server_start(const char *path, const char *name, int readyfd, const s->h = 24; s->running = 1; s->display = *display; + s->history_limit = history_limit; s->last_status = now_ms(); Window *w = window_new(s, NULL); @@ -4631,7 +4636,8 @@ static int ensure_socket_dir(void) { return 0; } -static int spawn_server(const char *path, const char *name, const DisplayOptions *display) { +static int spawn_server(const char *path, const char *name, + const DisplayOptions *display, int history_limit) { if (ensure_socket_dir() < 0) return -1; char dir[PATH_MAX], lockpath[PATH_MAX + 64]; socket_dir(dir, sizeof dir); @@ -4679,7 +4685,7 @@ static int spawn_server(const char *path, const char *name, const DisplayOptions if (dn > 2) close(dn); } close(lock); - server_start(path, name, p[1], display); + server_start(path, name, p[1], display, history_limit); _exit(1); } close(p[1]); @@ -4969,16 +4975,21 @@ static void print_help(FILE *out) { 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)"); help_row(out, "-c, --color RRGGBB", "status bar background, six hex digits (e.g. 000000)"); + char history_help[96]; + snprintf(history_help, sizeof history_help, + "history lines per pane in new sessions (0-%d, default: %d)", + MAX_HISTORY_LINES, DEFAULT_HISTORY_LINES); + help_row(out, "--history LINES", history_help); help_row(out, "--cwd", "show current directory in status bar"); help_row(out, "--clock", "show clock in status bar"); help_row(out, "--murx", "show [murx] in status bar unless --cwd is set"); help_row(out, "--hostname", "show hostname: prefix in window titles"); - help_row(out, "--hide-pane-titles", "hide the title row above each pane"); + help_row(out, "--pane-titles", "show the title row above each pane (default: off)"); fputs("\n" "Without -s or -c, an existing session keeps its position and color.\n" "Display options set new session values and can be changed later from\n" - "the Configuration menu. Pane titles are shown by default.\n" + "the Configuration menu.\n" "\n" "Shortcuts (press the prefix, release it, then press the key shown;\n" "Ctrl-A is the default prefix):\n" @@ -5039,7 +5050,8 @@ int main(int argc, char **argv) { unsigned char prefix = DEFAULT_PREFIX; int status = 0; uint32_t color = 0; - DisplayOptions display = {0, 0, 0, 0, 1}; + DisplayOptions display = {0}; + int history_limit = DEFAULT_HISTORY_LINES; int list = 0; while (argi < argc && argv[argi][0] == '-' && argv[argi][1]) { const char *option = argv[argi++]; @@ -5054,6 +5066,17 @@ int main(int argc, char **argv) { } if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) { list = 1; + } else if (strcmp(option, "--history") == 0) { + const char *value = argi < argc ? argv[argi] : ""; + char *end; + long lines = strtol(value, &end, 10); + if (*value < '0' || *value > '9' || *end || lines > MAX_HISTORY_LINES) { + fprintf(stderr, "murx: --history requires a line count from 0 to %d\n", + MAX_HISTORY_LINES); + return 2; + } + history_limit = (int)lines; + argi++; } else if (strcmp(option, "--cwd") == 0) { display.show_cwd = 1; } else if (strcmp(option, "--clock") == 0) { @@ -5062,8 +5085,8 @@ int main(int argc, char **argv) { display.show_murx = 1; } else if (strcmp(option, "--hostname") == 0) { display.show_hostname = 1; - } else if (strcmp(option, "--hide-pane-titles") == 0) { - display.show_pane_titles = 0; + } else if (strcmp(option, "--pane-titles") == 0) { + display.show_pane_titles = 1; } else if (strcmp(option, "-p") == 0 || strcmp(option, "--prefix") == 0) { if (argi >= argc || !parse_prefix(argv[argi], &prefix)) { fprintf(stderr, "murx: %s requires a letter from a through z\n", option); @@ -5123,7 +5146,7 @@ int main(int argc, char **argv) { make_socket_path(name, path, sizeof path); int fd = connect_session(path); - if (fd < 0) fd = spawn_server(path, name, &display); + if (fd < 0) fd = spawn_server(path, name, &display, history_limit); if (fd < 0) { if (errno != 0) { fprintf(stderr, "murx: cannot start or attach session '%s': %s\n", diff --git a/murx.png b/murx.png new file mode 100644 index 0000000..2a6ed76 Binary files /dev/null and b/murx.png differ