From 548f068cd4c9d31618ef382b86e215371099b810 Mon Sep 17 00:00:00 2001 From: Omer Hamerman Date: Sat, 18 May 2024 22:31:19 +0100 Subject: [PATCH] copying the filter process from the main plugin function to reload sessions. This should fix #72 so that the current session isn't filtered if set so in the config. --- scripts/reload_sessions.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/reload_sessions.sh b/scripts/reload_sessions.sh index a5ec3b1..fbbf8de 100755 --- a/scripts/reload_sessions.sh +++ b/scripts/reload_sessions.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash CURRENT_SESSION=$(tmux display-message -p '#S') -SESSIONS=$(tmux list-sessions | sed -E 's/:.*$//') -if [[ $(echo "$SESSIONS" | wc -l) -gt 1 ]]; then - echo "$SESSIONS" | grep -v "$CURRENT_SESSION" +filter_current_session=$(tmux_option_or_fallback "@sessionx-filter-current" "true") +if [[ "$filter_current_session" == "true" ]]; then + (tmux list-sessions | sed -E 's/:.*$//' | grep -v "$CURRENT_SESSION$") || echo "$CURRENT_SESSION" else - echo "$SESSIONS" + (tmux list-sessions | sed -E 's/:.*$//') || echo "$CURRENT_SESSION" fi -