From 4df41a68dbafa7f84fecacd4660bde1eda02e5d8 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sat, 16 Feb 2019 17:16:20 +0530 Subject: [PATCH] Add tmux detached plugin --- plugins/tmux.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/tmux.sh diff --git a/plugins/tmux.sh b/plugins/tmux.sh new file mode 100644 index 0000000..d914172 --- /dev/null +++ b/plugins/tmux.sh @@ -0,0 +1,22 @@ +function wish_tmux_start() { + return 0 +} + +function wish_tmux_end() { + return 0 +} + +function wish_tmux_set_colors() { + WISH_TMUX_FG=${WISH_TMUX_FG:-$WISH_DEFAULT_FG} + WISH_TMUX_BG=${WISH_TMUX_BG:-$WISH_DEFAULT_BG} + WISH_TMUX_SUFFIX=${WISH_TMUX_SUFFIX:-d} +} + +function wish_tmux_main() { + local s=`tmux list-sessions 2>/dev/null | grep -vE "\(attached\)$" | wc -l` + if [[ $s -eq 0 ]]; then + wish_append $WISH_TMUX_BG $WISH_TMUX_FG $tmux + else + wish_append $WISH_TMUX_BG $WISH_TMUX_FG " $s$WISH_TMUX_SUFFIX " + fi +}