1
0
Fork 0
forked from murx/murx

Prepare murx 1.0.2 release

This commit is contained in:
Johannes Findeisen 2026-11-23 11:39:43 +01:00
commit e83f0e8953
7 changed files with 104 additions and 55 deletions

View file

@ -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 - 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. `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 - `layout_apply()` assigns pane content rectangles. With `--pane-titles`,
(default), each leaf reserves its top row for a title and sets each leaf reserves its top row for a title and sets
`pane->y = layout->y + 1`; with `--hide-pane-titles`, content fills the leaf. `pane->y = layout->y + 1`. By default, content fills the leaf.
- Splits reserve one border column/row between children. With titles shown, - 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 horizontal splits use the lower pane's title row as the separator; with titles
hidden, horizontal splits draw a border row like vertical splits. hidden, horizontal splits draw a border row like vertical splits.

View file

@ -1,6 +1,6 @@
# Local source snapshot; refresh version and checksums with `make pkgsums`. # Local source snapshot; refresh version and checksums with `make pkgsums`.
pkgname=murx pkgname=murx
pkgver=1.0.1 pkgver=1.0.2
pkgrel=0 pkgrel=0
pkgdesc="Small persistent terminal multiplexer" pkgdesc="Small persistent terminal multiplexer"
url="https://codeberg.org/armin/murx" url="https://codeberg.org/armin/murx"
@ -26,10 +26,10 @@ package() {
} }
sha512sums=" sha512sums="
983e2ab3d7670a4d22b5b799741e2ad6d3801b2563c1b1d77cc7233e4b9aa0646dff9122dbc0b382162f2d44ae4ca8948a3221bf5eb31a974064a5dfd4f1268d murx.c 275a6a517689726858f106f27a921aab726d21260b876ef7d228d62f38800dd549dbeccea680b1f9261b01dda1c72860bb147e95270d66a8aa08a7b3a2e9823e murx.c
ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile ebce5c1268253d4dbf1cc1c7d6200c3bad97cba6361d8ff3c5d4563b670565a1a70d83d7bcb2dc0b1ca9fad9ca49d2ff8366b21ac73fb26cb7b46730d0acc425 Makefile
ba098e621d6aaa976cfbdbb4e892c6af4814f75c0f15bc0c59410d8be5b427721dfef17e5e17139b61c1268afa8c49a6bae857669bc1b0f115a0126daec45785 murx.1 219082e6277ee8c226cdd61a5b17d4e3c6893adf04b2f59ea84a6b6421dbd5a6d0ff38b93d8dd8ae41ed037e77252058dacadd5ff1f0c36c7c1ff95503e1e7a8 murx.1
4d207bfbff88293b8864a508eab169c4fb9c1e358efdeac4820bdfdb11cc7254dc8d0f50e60ac88e6d3803b39fd6e8a740309753a1d74db8d6634c702cc2b80b README.md 11c39781332eab62dc36125ed4b72df12208b73f3d9201a8a3f16b8b9c09f9e32069597f15160efd52d97609e7d322a09db7ce249361c0c84f7e22dc013e55d8 README.md
2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE
4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS
" "

View file

@ -1,6 +1,6 @@
# Local source snapshot; refresh version and checksums with `make pkgsums`. # Local source snapshot; refresh version and checksums with `make pkgsums`.
pkgname=murx pkgname=murx
pkgver=1.0.1 pkgver=1.0.2
pkgrel=1 pkgrel=1
pkgdesc='Small persistent terminal multiplexer' pkgdesc='Small persistent terminal multiplexer'
arch=('x86_64' 'aarch64') arch=('x86_64' 'aarch64')
@ -8,10 +8,10 @@ url='https://codeberg.org/armin/murx'
license=('Apache-2.0') license=('Apache-2.0')
depends=('glibc') depends=('glibc')
source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS') source=('murx.c' 'Makefile' 'murx.1' 'README.md' 'LICENSE' 'AUTHORS')
sha256sums=('b807f06d82023878160e5a5234fff53f60bc2e9a18b71f449693cd72264666bd' sha256sums=('a13edd7ca2da2d431ecd9e8fa1a4cae0a6e99a6a074893df204a73e8b3b19fc0'
'4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2' '4301fe8afe6a6e7cc665d8820ec43047f6af6f3b394a3a3a4f6e52dcf32fdec2'
'fbe804fcc53a3b3e261fcf7381fe90dddfb5035b4182fbe92013a921b297f8bc' '953966bfdd0b49cb26c11220e1e2bf6b5862aaa1b2d0bf002cde9d276f0ae96b'
'3c636ad59432991d29591fe956565ff53ddb78751f8c448b18a042f537102983' '6411f0a1129e0436fd2b86372ac58adb6336eb4b7eacff268650d5188626e8ff'
'31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4'
'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb')

View file

@ -17,8 +17,10 @@ make
./murx --cwd work # show the current directory in the status bar ./murx --cwd work # show the current directory in the status bar
./murx --murx work # show [murx] on the left of 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 -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 --clock work # show the status bar clock
./murx --hostname work # show the hostname: prefix in window titles ./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 -l, --list-sessions # list running sessions without attaching
./murx --help # version, usage and all shortcuts ./murx --help # version, usage and all shortcuts
./murx -v, --version # print the version and exit ./murx -v, --version # print the version and exit
@ -69,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 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 both are supplied. Use `--hostname` to show the `hostname:` prefix in window
names and the outer terminal title. These display options are disabled by 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; default. Use `--pane-titles` to show the title row above each pane. These
pane titles are shown by default. These options set the initial values for a options set the initial values for a new session. The `Configuration...` menu
new session; the `Configuration...` menu can change them in a running session can change them in a running session (see [Menu](#menu)). To restore the
(see [Menu](#menu)). To restore the previous default display, use previous default display, use
`murx --cwd --clock --hostname session`. `murx --cwd --clock --hostname session`.
## Upgrading from moerx ## Upgrading from moerx
@ -322,7 +324,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 and hostname. - Toggles for the current directory, clock, `[murx]` label, hostname and pane
titles.
- `Reset display/status defaults`. - `Reset display/status defaults`.
Settings changes apply immediately. Session settings affect all attached Settings changes apply immediately. Session settings affect all attached
@ -346,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 chooser. Use `Ctrl-A c` to create a window while browsing. Returning to a
window restores its scrollback view and position. window restores its scrollback view and position.
Each pane keeps up to 2,000 lines of normal screen history. The view is frozen Each pane keeps up to 2,000 lines of normal screen history by default.
while browsing; programs keep running and new output continues to be saved. 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. Scrollback views are private to each client and saved per pane while attached.
Alternate-screen programs such as editors do not add history; opening Alternate-screen programs such as editors do not add history; opening
scrollback there shows only their current screen. History is kept in memory, scrollback there shows only their current screen. History is kept in memory,
@ -379,11 +386,11 @@ Hard-coded:
report root status; install them in each remote shell, including root's. 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. A root shell that does not run the hooks cannot report its privilege change.
- Pane borders are thin box-drawing lines (`─`, `│`, `┬`, `┼`, ...) in - Pane borders are thin box-drawing lines (`─`, `│`, `┬`, `┼`, ...) in
`colour8`, drawn on the terminal's default background. By default, the row `colour8`, drawn on the terminal's default background. Enable title rows
above each pane is a title bar showing `[N: title]`: on the active pane, with `--pane-titles` or the Configuration menu. Each title row shows
brackets/numbers use `colour7`, separator `colour11`, title `colour15`; on `[N: title]`. On the active pane, brackets and numbers use `colour7`, the
inactive panes, `colour8`, `colour3`, `colour12`. Use `--hide-pane-titles` separator uses `colour11`, and the title uses `colour15`. Inactive panes
or the Configuration menu to hide title rows and give panes more space. use `colour8`, `colour3`, and `colour12`.
- Messages use `fg=colour6,bg=colour8`. - Messages use `fg=colour6,bg=colour8`.
- Menus use a black background with a `colour12` frame, `colour11` titles and - Menus use a black background with a `colour12` frame, `colour11` titles and
selection, `colour14` accents and dim `colour8` hints and separators. selection, `colour14` accents and dim `colour8` hints and separators.

View file

@ -1,3 +1,12 @@
# 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 # murx 1.0.1 released
**November 23, 2026** **November 23, 2026**

26
murx.1
View file

@ -6,10 +6,12 @@ murx \- small persistent terminal multiplexer
.RB [ \-p " letter"] .RB [ \-p " letter"]
.RB [ \-s " top|bottom"] .RB [ \-s " top|bottom"]
.RB [ \-c " RRGGBB"] .RB [ \-c " RRGGBB"]
.RB [ \-\-history " lines"]
.RB [ \-\-cwd ] .RB [ \-\-cwd ]
.RB [ \-\-clock ] .RB [ \-\-clock ]
.RB [ \-\-murx ] .RB [ \-\-murx ]
.RB [ \-\-hostname ] .RB [ \-\-hostname ]
.RB [ \-\-pane-titles ]
.RB [ \-\- ] .RB [ \-\- ]
.RI [ session ] .RI [ session ]
.br .br
@ -44,6 +46,12 @@ hyphens or underscores. Use
before a name beginning with a hyphen. before a name beginning with a hyphen.
.SH OPTIONS .SH OPTIONS
.TP .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 .BR \-l ", " \-\-list\-sessions
List running sessions for the current user, sorted by name, one per line. List running sessions for the current user, sorted by name, one per line.
Checks the runtime socket directory and /tmp fallback, skips stale sockets 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 .B \-\-hostname
Show the hostname: prefix in window names and the outer terminal title. Show the hostname: prefix in window names and the outer terminal title.
.TP .TP
.B \-\-hide-pane-titles .B \-\-pane-titles
Hide the title row above each pane. Pane titles are shown by default. Show the title row above each pane. Pane titles are off by default.
.TP .TP
.BR \-h ", " \-\-help .BR \-h ", " \-\-help
Print the program version, usage and keyboard shortcuts, then exit. 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. 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 and hostname change them in a running session. The cwd, clock, [murx] label, hostname
options are off by default; pane titles are shown by default. and pane title options are off by default.
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
@ -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. Use Ctrl-A c to create a window while browsing.
Returning to a window restores its scrollback view and position. Returning to a window restores its scrollback view and position.
.PP .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. Programs keep running while the view is frozen.
Scrollback views are private to each client and saved per pane while attached. Scrollback views are private to each client and saved per pane while attached.
Alternate-screen programs such as editors do not add history; 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 with --hostname. Its [murx] prefix is always present; --murx controls only
the status label. the status label.
Hostnames are shortened at the first dot. 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 [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 brackets/numbers, colour11 separator and colour15 title; inactive panes use
colour8, colour3 and colour12. Use --hide-pane-titles or the Configuration colour8, colour3 and colour12. Toggle title rows in the Configuration menu.
menu to hide title rows. Splits use thin box-drawing lines in colour8. Splits use thin box-drawing lines in colour8.
The status uses colour12, accents colour14 and the current window colour11. The status uses colour12, accents colour14 and the current window colour11.
The current window name turns bright red (colour9) when its active pane's 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 foreground process is su or has effective UID 0, including programs launched

71
murx.c
View file

@ -87,7 +87,7 @@
#define MURX_NOIPA #define MURX_NOIPA
#endif #endif
#define MURX_VERSION "1.0.1" #define MURX_VERSION "1.0.2"
#define DEFAULT_PREFIX 0x01 #define DEFAULT_PREFIX 0x01
/* client -> server */ /* client -> server */
@ -393,7 +393,8 @@ typedef enum {
PS_STRING_ESC PS_STRING_ESC
} ParseState; } ParseState;
#define HISTORY_LINES 2000 #define DEFAULT_HISTORY_LINES 2000
#define MAX_HISTORY_LINES 100000
typedef struct Pane Pane; typedef struct Pane Pane;
@ -409,7 +410,7 @@ struct Pane {
Grid *grid; Grid *grid;
int on_alt; int on_alt;
Grid *history; /* ring of rows, retaining their original widths */ 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 cx, cy;
int wrap_pending; int wrap_pending;
@ -551,13 +552,14 @@ static void em_scroll_up(Pane *p, int n) {
if (n < 1) n = 1; if (n < 1) n = 1;
if (n > p->scroll_bot - p->scroll_top + 1) n = p->scroll_bot - p->scroll_top + 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. */ /* 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_limit > 0 && !p->on_alt &&
if (!p->history) p->history = xcalloc(HISTORY_LINES, sizeof(Grid)); 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++) { for (int y = 0; y < n; y++) {
int slot = (p->history_start + p->history_count) % HISTORY_LINES; int slot = (p->history_start + p->history_count) % p->history_limit;
if (p->history_count == HISTORY_LINES) { if (p->history_count == p->history_limit) {
grid_free(&p->history[slot]); 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++; } else p->history_count++;
grid_init(&p->history[slot], g->w, 1); grid_init(&p->history[slot], g->w, 1);
memcpy(p->history[slot].c, &g->c[y * g->w], (size_t)g->w * sizeof(Cell)); 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; if (n < 1) n = 1;
p->cx = 0; p->cx = 0;
/* Further blank scrolling cannot change the screen or history. */ /* 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); for (int i = 0; i < n; i++) pane_lf(p);
break; break;
case 'F': case 'F':
@ -1325,6 +1327,7 @@ struct Session {
int status_bottom; int status_bottom;
int32_t status_bg; /* 0 uses the terminal default */ int32_t status_bg; /* 0 uses the terminal default */
DisplayOptions display; DisplayOptions display;
int history_limit;
Window *windows; Window *windows;
Window *cur, *last; Window *cur, *last;
int nwin; int nwin;
@ -1521,14 +1524,14 @@ static void pane_free(Pane *p) {
grid_free(&p->main_grid); grid_free(&p->main_grid);
grid_free(&p->alt_grid); grid_free(&p->alt_grid);
if (p->history) { 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->history);
} }
free(p); free(p);
} }
static Pane *pane_new(const char *cwd, int w, int h, const char *title, 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; struct winsize iws;
memset(&iws, 0, sizeof iws); memset(&iws, 0, sizeof iws);
iws.ws_col = tty_dimension(w > 0 ? w : 80); 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->pid = pid;
p->alive = 1; p->alive = 1;
p->tty_fd = slave_fd; p->tty_fd = slave_fd;
p->history_limit = history_limit;
p->cursor_visible = 1; p->cursor_visible = 1;
p->pen.fg = DEFAULT_COLOR; p->pen.fg = DEFAULT_COLOR;
p->pen.bg = 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 pw = s->w > 0 ? s->w : 80;
int ph = s->h > 1 ? s->h - 1 : 23; int ph = s->h > 1 ? s->h - 1 : 23;
if (ph < 1) ph = 1; 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) { if (!p) {
free(w); free(w);
return NULL; return NULL;
@ -3057,7 +3061,7 @@ static void switch_last_window(Session *s) {
static Pane *host_pane_new(Session *s, int w, int h) { static Pane *host_pane_new(Session *s, int w, int h) {
char host[128]; char host[128];
short_hostname(host, sizeof host); 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) { 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_free(&view->grid);
grid_init(&view->grid, p->grid->w, count + p->grid->h); grid_init(&view->grid, p->grid->w, count + p->grid->h);
for (int y = 0; y < count + p->grid->h; y++) { 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 sy = y < count ? 0 : y - count;
int width = row->w < view->grid.w ? row->w : view->grid.w; 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], 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_KILL_SERVER: start_confirm(c, 2, "kill-server? (y/n) "); break;
case ACT_RESET_DISPLAY: case ACT_RESET_DISPLAY:
memset(&s->display, 0, sizeof s->display); memset(&s->display, 0, sizeof s->display);
s->display.show_pane_titles = 1;
s->status_bottom = 0; s->status_bottom = 0;
s->status_bg = 0; s->status_bg = 0;
session_layout(s); session_layout(s);
@ -4416,7 +4419,8 @@ static void server_fail(int readyfd, const char *stage, int err) {
close(readyfd); 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(SIGPIPE, SIG_IGN);
signal(SIGHUP, SIG_IGN); signal(SIGHUP, SIG_IGN);
signal(SIGCHLD, SIG_DFL); 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->h = 24;
s->running = 1; s->running = 1;
s->display = *display; s->display = *display;
s->history_limit = history_limit;
s->last_status = now_ms(); s->last_status = now_ms();
Window *w = window_new(s, NULL); Window *w = window_new(s, NULL);
@ -4631,7 +4636,8 @@ static int ensure_socket_dir(void) {
return 0; 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; if (ensure_socket_dir() < 0) return -1;
char dir[PATH_MAX], lockpath[PATH_MAX + 64]; char dir[PATH_MAX], lockpath[PATH_MAX + 64];
socket_dir(dir, sizeof dir); 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); if (dn > 2) close(dn);
} }
close(lock); close(lock);
server_start(path, name, p[1], display); server_start(path, name, p[1], display, history_limit);
_exit(1); _exit(1);
} }
close(p[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, "-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, "-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)"); 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, "--cwd", "show current directory in status bar");
help_row(out, "--clock", "show clock 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, "--murx", "show [murx] in status bar unless --cwd is set");
help_row(out, "--hostname", "show hostname: prefix in window titles"); 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" fputs("\n"
"Without -s or -c, an existing session keeps its position and color.\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" "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" "\n"
"Shortcuts (press the prefix, release it, then press the key shown;\n" "Shortcuts (press the prefix, release it, then press the key shown;\n"
"Ctrl-A is the default prefix):\n" "Ctrl-A is the default prefix):\n"
@ -5039,7 +5050,8 @@ int main(int argc, char **argv) {
unsigned char prefix = DEFAULT_PREFIX; unsigned char prefix = DEFAULT_PREFIX;
int status = 0; int status = 0;
uint32_t color = 0; uint32_t color = 0;
DisplayOptions display = {0, 0, 0, 0, 1}; DisplayOptions display = {0};
int history_limit = DEFAULT_HISTORY_LINES;
int list = 0; int list = 0;
while (argi < argc && argv[argi][0] == '-' && argv[argi][1]) { while (argi < argc && argv[argi][0] == '-' && argv[argi][1]) {
const char *option = argv[argi++]; 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) { if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) {
list = 1; 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) { } else if (strcmp(option, "--cwd") == 0) {
display.show_cwd = 1; display.show_cwd = 1;
} else if (strcmp(option, "--clock") == 0) { } else if (strcmp(option, "--clock") == 0) {
@ -5062,8 +5085,8 @@ int main(int argc, char **argv) {
display.show_murx = 1; display.show_murx = 1;
} else if (strcmp(option, "--hostname") == 0) { } else if (strcmp(option, "--hostname") == 0) {
display.show_hostname = 1; display.show_hostname = 1;
} else if (strcmp(option, "--hide-pane-titles") == 0) { } else if (strcmp(option, "--pane-titles") == 0) {
display.show_pane_titles = 0; display.show_pane_titles = 1;
} else if (strcmp(option, "-p") == 0 || strcmp(option, "--prefix") == 0) { } else if (strcmp(option, "-p") == 0 || strcmp(option, "--prefix") == 0) {
if (argi >= argc || !parse_prefix(argv[argi], &prefix)) { if (argi >= argc || !parse_prefix(argv[argi], &prefix)) {
fprintf(stderr, "murx: %s requires a letter from a through z\n", option); 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); make_socket_path(name, path, sizeof path);
int fd = connect_session(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 (fd < 0) {
if (errno != 0) { if (errno != 0) {
fprintf(stderr, "murx: cannot start or attach session '%s': %s\n", fprintf(stderr, "murx: cannot start or attach session '%s': %s\n",