From af5d43fb36b38a07e6e010f299da5be322775ba4 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Fri, 17 Jan 2025 09:05:09 +0000 Subject: [PATCH] =?UTF-8?q?feat(rc):=20Am=C3=A9lioration=20de=20la=20gesti?= =?UTF-8?q?on=20de=20tmux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rc.d/tmux | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rc.d/tmux b/rc.d/tmux index a695b74..7ff7bfc 100644 --- a/rc.d/tmux +++ b/rc.d/tmux @@ -1,17 +1,14 @@ #!/bin/bash # GNU Screen stuff -if ( which tmux &> /dev/null ) -then - if [ $(pgrep -u "$UID" "tmux" | wc -l) -gt 0 ] - then - if [[ $TERM != screen* ]] - then +if (command -v tmux &>/dev/null); then + if [ "$(pgrep -u "$UID" "tmux" | wc -l)" -gt 0 ]; then + if [[ $TERM != screen* ]]; then nb_sessions=$(tmux list-session | wc -l) - nb_sessions_attached=$(tmux list-session | grep "attached" | wc -l) - nb_sessions_detached=$(tmux list-session | grep -v "attached" | wc -l) + nb_sessions_attached=$(tmux list-session | grep -c "attached") + nb_sessions_detached=$(tmux list-session | grep -c -v "attached") - echo_reverse "Found ${nb_sessions} tmux session(s)" + echo_info "Found ${nb_sessions} tmux session(s)" echo " * ${nb_sessions_attached} attached" tmux list-sessions | grep "attached" | sed -e 's/^/ - /' @@ -22,4 +19,3 @@ then fi fi fi -