diff --git a/APKBUILD b/APKBUILD index 66a0d40..1ba4f3b 100644 --- a/APKBUILD +++ b/APKBUILD @@ -26,10 +26,10 @@ package() { } sha512sums=" -cca1f9816de1cdaa97c2543d74ec52fec4813c9068d756f8f940c82b58c7b3afd631a20991c981b3bc75a968d1d3d9ed36182150e32a6a7718863045643c4264 murx.c +a2ce74a762c5d4a29ed2a0c1db930c4d6c5a02ff1b75c87c1a713ed3db01f26356d4a9bc73b43da7a94e05e90421353c7db3e5765a219b05adfda5690917c683 murx.c ca73b902d64fc9dc52d8d14b6c8ca6b494f4bea3f3602c29fd2909252668e110edff075c881e014e689d7c7d990dee2a4a96208276bae50243ca382adc5ead80 Makefile -7e2535df251ac8d4a64dc8ad379337798f10afb4d0ab1642e5d010128344b626d03f08363c280cdfdb512d666a62a96fad8f4f6a2be53ae2b9bd5c13bdf0491c murx.1 -9a3bb80832e106746bd55bb1f0ffa2ee4ce7e7b141b734971756742fa28d34e310cd41867a661aef01b6b1e43903749422f135aeb97e70bc3e884d7dfe2fb0e9 README.md +e084b9d2eaf2d93080898439a98e9a0a9acf2e076a53849f89ea0fff9a24d277cb348736cd3607bf18c9b94bd72af1c60d37617af9347d0452a04aff7160bedb murx.1 +af70fd707b1bcaaac68fffe8090783e06c9d494cc2ad11c0bfcc8e963bd51a658a02b17e296ed4017b87ffd04a412389c04d65a3192f78908deb7d70645162c1 README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/PKGBUILD b/PKGBUILD index fcfbb14..527a363 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -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=('6e6b2ce665984239d753cd5683ae9469009763420ced4a0048f18788df350dd6' +sha256sums=('0e30a88aac206f531087115521b3233acd35c011d625c44ff0c7e6809600d92f' 'c683ed74c664ebb2a72603297367ed102afdf27e4d6cee47920db8632a8efa91' - '0a2be096fb83ff1a17d0194547a40a84337c0c5c43da5f0940d1aecd76f742bf' - '476af085c9d2d54d047757b45e2e1bcf39798df500a4c98eac3d9cea727fb50f' + '22bcaf7178867f0978616634951c6b89f9812698f9d21541cd742049dd6069e5' + '1155ea87e045f7cb90608c278abadf085c51ebf304d075eebf4f83d44fe30dc4' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') diff --git a/README.md b/README.md index 584f849..f2a8525 100644 --- a/README.md +++ b/README.md @@ -337,9 +337,10 @@ Hard-coded: borders; panes have no title row, leaving more space for terminal content. - Messages use `fg=colour6,bg=colour8`. -Use `-c RRGGBB` or `--color RRGGBB` to set this client's status bar -background. Supply six hexadecimal digits, such as `000000` for black. Repeat -the option when reattaching. Omitting it uses the terminal's default background. +Use `-c RRGGBB` or `--color RRGGBB` to set the session's status bar +background for all attached clients. Supply six hexadecimal digits, such as +`000000` for black. The session remembers the color across reattachments. New +sessions use the terminal's default background unless a color is supplied. Colours are written to the outer terminal in 256-colour form (`38;5;n` / `48;5;n`). Truecolor from a pane is mapped to the nearest xterm-256 entry, diff --git a/murx.1 b/murx.1 index 8f09391..35e01cf 100644 --- a/murx.1 +++ b/murx.1 @@ -59,10 +59,10 @@ for all clients. Omitting this option preserves the session's position. Prompts and messages follow the status line. .TP .BR \-c " RRGGBB, " \-\-color " RRGGBB" -Set this client's status bar background. +Set the session's status bar background for all attached clients. Supply six hexadecimal digits, such as 000000 for black. -Repeat this option when reattaching. Omitting it uses the terminal's default -background. +Omitting this option preserves the session's color when reattaching. New +sessions use the terminal's default background unless a color is supplied. .TP .B \-\-cwd Show the current directory at the left of the status line. diff --git a/murx.c b/murx.c index 357ee9e..9a9bcf0 100644 --- a/murx.c +++ b/murx.c @@ -1213,7 +1213,6 @@ struct Client { int attached; uint64_t order; /* attach/resize sequence, newest client wins */ int truecolor; - int32_t status_bg; unsigned char in[16384]; size_t inlen; long long escape_since; @@ -1265,6 +1264,7 @@ struct Session { int w, h; int status_bottom; + int32_t status_bg; /* 0 uses the terminal default */ DisplayOptions display; Window *windows; Window *cur, *last; @@ -2114,10 +2114,10 @@ static void status_draw(Grid *g, Session *s, Client *c) { status_right_draw(g, rx, y, clockbuf); } - if (c->status_bg != DEFAULT_COLOR) { + if (s->status_bg) { for (int x = 0; x < s->w; x++) { Cell *cell = grid_at(g, x, y); - if (cell->bg == DEFAULT_COLOR) cell->bg = c->status_bg; + if (cell->bg == DEFAULT_COLOR) cell->bg = s->status_bg; } } } @@ -3464,7 +3464,7 @@ static void handle_message(Client *c, Session *s, uint32_t type, const unsigned uint32_t color = 0; if (len >= 24) memcpy(&color, data + 20, 4); if (color && (color >> 24) != 1) { c->dead = 1; return; } - c->status_bg = color ? (int32_t)color : DEFAULT_COLOR; + if (color) s->status_bg = (int32_t)color; if (status) { s->status_bottom = status == 2; session_layout(s); @@ -4296,9 +4296,9 @@ static void print_help(FILE *out) { "Use -s top|bottom (or --status top|bottom) to position the status line.\n" "New sessions default to top; an explicit choice updates all attached clients.\n" "Without -s, keep the session position.\n" - "Use -c RRGGBB (or --color RRGGBB) to set this client's status bar background.\n" + "Use -c RRGGBB (or --color RRGGBB) to set the session's status bar background.\n" "Specify six hexadecimal digits, such as 000000 for black.\n" - "Without -c, use the terminal's default background.\n" + "New sessions use the terminal default. Without -c, keep the session color.\n" "Use --cwd to show the current directory in the status bar.\n" "Use --clock to show the clock in the status bar.\n" "Use --murx to show [murx] in the status bar when --cwd is not enabled.\n"