From 549b689caf4f12615520e6558b011ffbaf2bad09 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Wed, 12 Oct 2022 13:54:33 -0400 Subject: [PATCH] Simplify tmux status reporting --- home/lib/login_functions.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index b6dd8a6..a691958 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -674,7 +674,7 @@ status() { echo 'accounting' - printf '%stmux (s->c)\n' "$indent_unit" + printf '%stmux\n' "$indent_unit" ps -eo comm,cmd \ | awk ' # Expecting lines like: @@ -689,9 +689,9 @@ status() { split(sides_of_L[2], words_right_of_L, FS) sock=words_right_of_L[1] if (!sock) { - sock = "anon" + sock = "default" } else { - sock = "named." sock + sock = "\"" sock "\"" } roles[role]++ socks[sock]++ @@ -699,15 +699,13 @@ status() { } END { - sock_sep = "" for (sock in socks) { - printf "%s%s ", sock_sep, sock - sock_sep = "\n" - role_sep = "" - for (role in roles) { - printf "%s%d", role_sep, count[role, sock] - role_sep = "->" + clients = count["client", sock] + printf "%s ", sock + if (clients) { + printf "<-> %d", clients } + printf "\n" } printf "\n" }' \ -- 2.20.1