commit f7e21ef5e82e9ee14c3fb85573ee80522f6a5dbc parent 976bd555b2700f61efd83e802c936145aec1a3e6 Author: Alex Balgavy <alexander.balgavy@spaceapplications.com> Date: Sat, 14 Dec 2024 15:46:28 +0100 dwmblock-tmuxlist: show number of tmux windows if not attached Diffstat:
A | scripts/dwmblock-tmuxlist | | | 10 | ++++++++++ |
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/scripts/dwmblock-tmuxlist b/scripts/dwmblock-tmuxlist @@ -0,0 +1,10 @@ +#!/bin/sh +case $BUTTON in + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +n_sessions="$(tmux list-sessions | wc -l)" +attached="$(tmux list-sessions | grep '(attached)')" +if [ "$n_sessions" -gt 0 ] && [ -z "$attached" ]; then + printf " %s" "$n_sessions" +fi