diff --git a/APKBUILD b/APKBUILD index 7fecb4d..edeac37 100644 --- a/APKBUILD +++ b/APKBUILD @@ -26,10 +26,10 @@ package() { } sha512sums=" -86f7e6ac508fd46badde9ad6bba7a31e2cc896d43c0265b8014561ea4f8bea4dd76fa5ebc0df9fef53ae456feb4f5cdc808ee8b7a31ad8f5849c2436fa82687b murx.c -4f52ecfc78bb993f9bdbaa235f671fe54327497fa8e21517805a2696bea9f06d335e4da564d0019ec1fad86986c05bce90e4825dcebc2ef3c0bc66fb9a768030 Makefile -523ac85c9b789a7721c76e8f7691a1a8ab43d7fec2624f43b3850e5135451d94404d8711fa40422a67e9f13b7388470436ab06deb6ad7c87c7e72a37492ae617 murx.1 -dd4c8734c16b5d454fe638db8ed38d09337e58f89634be5d552cd72757820922207fe36f87ca77087303e8a36dedc269b27620d4c5fb0052f474e1c5892fd38a README.md +6a0b08780bb7b6a743535ce93dd648fb534a59274dcc1a0008a64737d7f8d7af2a56ac385ab3f6c74b836df93819d3b6d1c190a0074442a2e7c4e02621c6c25d murx.c +69e5d1d2d0c8cacc3b036e52ea186219423b8a8223f4b08587ef8d3c629addc51960645ddb4e8a6108d81db2165daf037941403cbc230c098de2430c93027df8 Makefile +ea99904e2e3b02c1a2f3bd8e1f2faef9aeb3cd8bc97c2ab14ce2d66de7d16a804bbf9610ade09385fd2a660493372cf335faae2cc30ccec8b62d019ad95ae457 murx.1 +6874ff4290c258c93f5bf5d4c7b11ab4bb1237c0dcd758f3c144989181d6cac9a738eb6cedfa6b9935ad47c8bf523226a1c0040de96608509dcb7097c4afda49 README.md 2fe33ba22c5f68e124904be594208f050be20f33d115f9a56f60cac93304102da32e6a7e78154e831d3704da7ca8bfefd7025e7b8901e65babcd83e7342f6382 LICENSE 4d32dba475e5f9818fcd008068b011cbae9fc4b8e29897c933775d6660f44a7992d08a1550320d83233af729a42b241ef1d182bf5983ef2f64deab76cab2260d AUTHORS " diff --git a/Makefile b/Makefile index 0988647..37a51d4 100644 --- a/Makefile +++ b/Makefile @@ -22,4 +22,8 @@ uninstall: clean: rm -f murx +pkgclean: + rm -rf *.apk + rm -rf *.xz + .PHONY: all install uninstall clean diff --git a/PKGBUILD b/PKGBUILD index 4af3419..ceeb25d 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=('386ad2bc32092e5380cb6a7e24accffcac72c202d9c926a896e574c2b2fdbd5a' - '1d77a97ff77ce6d876baef98e22b06cfa2109a4ae65cef8b75a91df4c02ad8ac' - 'f07830b93f78674956a17b108738d52c3d3efd58f431dc29f137cc339d625ee5' - '141849d70220b501465bd021e71c3b27854162453dc0b18d6859868e1f7eff02' +sha256sums=('48100d532f03e500c8d7d200fb88f4543aedf5f5c4f4f9fe91e420f12310d67b' + '6c0ed9ca242a68a69831386b6b5edc6e0a6b042cb88e4fdbc77ff6a69ce10725' + 'd7d36ecc3e8ab59cebfdcca317231e5eaae136d3097e7fe2ef8c2540886bf21a' + '39494a67f7fdb2052b4782ad9f85a7b403c4a5fb3145027d989b8bdfa6eb5a67' '31c5556be4cdd9bf52bb55f18ead0c68a4f0e793c2c2dab0a2a2c6d92407d0d4' 'dbc8a4fc569d4cd7bcd45516ccc98c1396fce0682c262103069c8f5150538cdb') diff --git a/README.md b/README.md index 74f6922..d30638d 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ make ./murx --prefix x work # same as -p x ./murx -s bottom work # show the session status line at the bottom ./murx --status bottom work # same as -s bottom -./murx --no-cwd work # show [murx] instead of the directory -./murx --no-cwd --no-murx work # do not show [murx] instead of the directory -./murx --no-clock work # hide the status bar clock -./murx --no-hostname work # hide the hostname: prefix in window titles +./murx --cwd work # show the current directory in the status bar +./murx --murx work # show [murx] on the left of the status bar +./murx --clock work # show the status bar clock +./murx --hostname work # show the hostname: prefix in window titles ./murx -l, --list-sessions # list running sessions without attaching ./murx --help # all shortcuts ``` @@ -59,17 +59,20 @@ existing session for all attached clients; omitting the option preserves its position. Prompts and messages follow the status line. Restart servers from older versions once before using this option. -Use `--no-cwd` to show `[murx]` on the left of the status bar instead of the -current directory, and `--no-clock` to hide the clock on the right. Use -`--no-murx` to hide `[murx]` when using `--no-clock` (and `--no-cwd`). Use -`--no-hostname` to hide the `hostname:` prefix in window names and the outer -terminal title. These options apply when starting a new session. +Use `--cwd` to show the current directory on the left of the status bar, +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. All four features are disabled by default. +These options apply when starting a new session and do not change an existing +session. To restore the previous default display, use +`murx --cwd --clock --hostname session`. ## Upgrading from moerx The executable, source and manual are now `murx`, `murx.c` and `murx.1`. -Update aliases and scripts to use `murx` and replace `--no-moerx` with -`--no-murx`. Sessions use a separate `murx-` socket directory; finish +Update aliases and scripts to use `murx`. The status label is now disabled +by default; use `--murx` to enable it. Sessions use a separate `murx-` socket directory; finish existing sessions with the old executable before removing it. Existing sessions are not migrated automatically. Replace the optional remote SSH hooks below and reload the remote shell: custom reports now use `murx-cwd` @@ -96,15 +99,18 @@ and `murx-root`. session server to apply the fix. In an existing shell, `umask 022` restores typical public file permissions for subsequent commands, including builds published with `rsync -a`. -- Window names show `hostname:program` for the foreground program in their - active pane (for example `laptop:zsh` or `laptop:vim`), refreshed - every second, including in inactive windows. With `--no-hostname`, they show - only `program`. When a program exits, the name returns to the shell. For +- Window names show `program` for the foreground program in their active pane, + refreshed every second, including in inactive windows. With `--hostname`, + they show `hostname:program` (for example `laptop:zsh` or `laptop:vim`). When a program exits, the name returns to the shell. For pipelines, the foreground process group leader supplies the name. Linux uses `/proc`; other systems use `ps`. ## SSH window names and directories (optional) +Enable `--hostname` to display reported remote hostnames and `--cwd` to +display reported remote directories when creating the session. The hostname +examples below assume `--hostname` is enabled. + This section is **optional** and only needed if you want `murx` to show details from inside an SSH session (remote hostname/program in window titles and the window list, remote working directory in the status line, and reported @@ -308,7 +314,7 @@ Hard-coded: - Status on top by default (`-s bottom` moves it), default background, foreground `colour12`. The palette mirrors `~/.tmux.conf`. -- `[/path/to/directory]` on the left (directory in `colour14`, brackets +- With `--cwd`, `[/path/to/directory]` on the left (directory in `colour14`, brackets `colour12`), refreshed every second and when switching panes. On Linux this follows the active pane's foreground process, falling back to its shell's directory; on other systems it shows the session's starting directory. @@ -316,7 +322,8 @@ Hard-coded: appears as `[~]`. Long paths end in `...` to leave room for the window list and clock; the directory label is hidden when fewer than four columns remain. Remote SSH directories require a shell report; see [SSH window names and directories](#ssh-window-names-and-directories). -- `HH:MM:SS` on the right in `colour12`, refreshed every second. +- With `--murx` and without `--cwd`, `[murx]` on the left. +- With `--clock`, `HH:MM:SS` on the right in `colour12`, refreshed every second. - Window list right-aligned: current name `colour11`, or red `colour9` when its active pane's foreground process is `su` or has effective UID 0. Other window names use `colour12`; separators/flags use `colour14`. The color @@ -334,9 +341,10 @@ Colours are written to the outer terminal in 256-colour form (`38;5;n` / unless the outer terminal advertises `COLORTERM=truecolor` and is not screen/tmux/linux. -The terminal window title is set to `[murx] hostname:program`, following the -active murx window (or `[murx] program` with `--no-hostname`). Hostnames use -their short form (before the first dot). +The terminal window title is set to `[murx] program`, following the active +murx window, or `[murx] hostname:program` with `--hostname`. Hostnames use +their short form (before the first dot). The `[murx]` prefix in the outer +terminal title is always present; `--murx` controls only the status bar label. ## Deliberate limitations diff --git a/murx.1 b/murx.1 index 9d254ab..8be8a65 100644 --- a/murx.1 +++ b/murx.1 @@ -5,10 +5,10 @@ murx \- small persistent terminal multiplexer .B murx .RB [ \-p " letter"] .RB [ \-s " top|bottom"] -.RB [ \-\-no\-cwd ] -.RB [ \-\-no\-clock ] -.RB [ \-\-no\-murx ] -.RB [ \-\-no\-hostname ] +.RB [ \-\-cwd ] +.RB [ \-\-clock ] +.RB [ \-\-murx ] +.RB [ \-\-hostname ] .RB [ \-\- ] .RI [ session ] .br @@ -57,26 +57,27 @@ New sessions default to top. An explicit choice changes an existing session for all clients. Omitting this option preserves the session's position. Prompts and messages follow the status line. .TP -.B \-\-no\-cwd -Show [murx] instead of the current directory at the left of the status line. +.B \-\-cwd +Show the current directory at the left of the status line. .TP -.B \-\-no\-clock -Hide the status clock. +.B \-\-clock +Show the status clock. .TP -.B \-\-no\-murx -Hide the [murx] label when the directory is disabled with -.BR \-\-no\-cwd . -This does not hide an enabled directory or require the clock to be disabled. +.B \-\-murx +Show the [murx] label at the left of the status line when +.B \-\-cwd +is not enabled. The directory takes precedence if both options are supplied. .TP -.B \-\-no\-hostname -Hide the hostname: prefix in window names and the outer terminal title. +.B \-\-hostname +Show the hostname: prefix in window names and the outer terminal title. .TP .BR \-h ", " \-\-help Print usage and keyboard shortcuts, then exit. .PP -The four -.B \-\-no\-* -options apply only when creating a session; they do not change a running server. +These four display features are disabled by default. Their options apply only +when creating a session; they do not change a running server. +To restore the previous default display, use +.BR "murx \-\-cwd \-\-clock \-\-hostname session" . .SH KEY BINDINGS Every binding below starts with the prefix: press Ctrl-A, release it, then press the remaining key. Substitute your chosen prefix throughout, @@ -205,7 +206,9 @@ opening scrollback there shows only their current screen. Colors are retained; lines are clipped or padded to the pane width without reflow. Text selection and copying are not provided. .SH STATUS AND TERMINAL DISPLAY -The left side shows [/path/to/directory]. On Linux the directory follows the +With --cwd, the left side shows [/path/to/directory]. With --murx and without +--cwd, it shows [murx]. By default neither label is shown. +On Linux the directory follows the active pane's foreground process, falling back to its shell and then the session's starting directory. Other systems use the starting directory unless a shell reports a path. Local HOME paths are abbreviated with ~. @@ -214,14 +217,17 @@ the label is hidden if fewer than four columns remain. .PP The window list is right-aligned. Each entry contains its number and name; * marks the current window and a trailing hyphen marks the previous window. -Names follow hostname:program for each window's active foreground job, +Names show program for each window's active foreground job, +or hostname:program with --hostname, including inactive windows, and refresh within one second. Pipelines use the foreground process group leader's name. Returning to the shell restores its name. Linux uses /proc; other systems use ps. -The right side shows HH:MM:SS, refreshed every second. +With --clock, the right side shows HH:MM:SS, refreshed every second. .PP -The outer terminal title follows [murx] hostname:program. +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. Panes have no title rows; only splits have separator lines. The status uses colour12, accents colour14 and the current window colour11. @@ -248,6 +254,10 @@ Ctrl-A * lists attached clients for size diagnostics. Terminal size changes are checked every 250 milliseconds as well as on SIGWINCH. Resizing does not reflow existing text. .SH REMOTE SHELL INTEGRATION +Enable --hostname to display reported remote hostnames and --cwd to display +reported directories when creating the session. The hostname examples below +assume --hostname is enabled. +.PP SSH does not expose remote foreground programs or working directories locally. Configure the remote shell to send terminal reports using one of the examples below. Reload the shell configuration or open a new SSH shell afterward. @@ -426,7 +436,7 @@ murx \-\-prefix x \-\-status bottom work Start a session with a minimal status display: .PP .nf -murx \-\-no\-cwd \-\-no\-murx \-\-no\-clock \-\-no\-hostname minimal +murx minimal .fi .PP Detach with Ctrl-A d (or Ctrl-X d with the alternate prefix), then run the @@ -434,7 +444,8 @@ same session command to reattach. Exit the last pane's shell to end the session, or use the confirmed kill-pane, kill-window or kill-server bindings. .SH UPGRADING FROM MOERX The executable and manual are now murx and murx(1). Update scripts and aliases, -and replace the old status-label option with \fB\-\-no\-murx\fR. +and remove the old status-label disabling option. The label is now disabled +by default; use \fB\-\-murx\fR to enable it. Sessions use a separate murx- socket directory and are not migrated. Finish existing sessions with the old executable before removing it. Replace optional remote shell hooks and reload the remote shell; diff --git a/murx.c b/murx.c index 7ea28cb..69b7112 100644 --- a/murx.c +++ b/murx.c @@ -4259,7 +4259,7 @@ static int run_client(int fd, const char *name, unsigned char prefix, int status static void print_help(FILE *out) { fprintf(out, - "usage: murx [-p letter] [-s top|bottom] [--no-cwd] [--no-clock] [--no-murx] [--no-hostname] [session]\n" + "usage: murx [-p letter] [-s top|bottom] [--cwd] [--clock] [--murx] [--hostname] [session]\n" " murx -l | --list-sessions\n" " murx -h | --help\n" "\n" @@ -4271,10 +4271,11 @@ 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 --no-cwd to hide the current directory in the status bar.\n" - "Use --no-clock to hide the clock in the status bar.\n" - "Use --no-murx to hide [murx] in the status bar when using --no-cwd.\n" - "Use --no-hostname to hide the hostname: prefix in window titles.\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" + "Use --hostname to show the hostname: prefix in window titles.\n" + "These four features default to off and apply only to new sessions.\n" "\n" "Use -p x (or --prefix x) to choose Ctrl-X as this client's prefix.\n" "Letters a through z are supported (case-insensitive); the default is a (Ctrl-A).\n" @@ -4349,7 +4350,7 @@ int main(int argc, char **argv) { int argi = 1; unsigned char prefix = DEFAULT_PREFIX; int status = 0; - DisplayOptions display = {1, 1, 1, 1}; + DisplayOptions display = {0, 0, 0, 0}; int list = 0; while (argi < argc && argv[argi][0] == '-' && argv[argi][1]) { const char *option = argv[argi++]; @@ -4360,14 +4361,14 @@ int main(int argc, char **argv) { } if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) { list = 1; - } else if (strcmp(option, "--no-cwd") == 0) { - display.show_cwd = 0; - } else if (strcmp(option, "--no-clock") == 0) { - display.show_clock = 0; - } else if (strcmp(option, "--no-murx") == 0) { - display.show_murx = 0; - } else if (strcmp(option, "--no-hostname") == 0) { - display.show_hostname = 0; + } else if (strcmp(option, "--cwd") == 0) { + display.show_cwd = 1; + } else if (strcmp(option, "--clock") == 0) { + display.show_clock = 1; + } else if (strcmp(option, "--murx") == 0) { + display.show_murx = 1; + } else if (strcmp(option, "--hostname") == 0) { + display.show_hostname = 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);