config-bash/rc.d/tmux

26 lines
664 B
Plaintext
Raw Normal View History

2015-03-24 12:26:49 +01:00
#!/bin/bash
# GNU Screen stuff
if ( which tmux &> /dev/null )
then
if [ $(pgrep "tmux" | wc -l) -gt 0 ]
2015-03-24 12:26:49 +01:00
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)
echo_reverse "Found ${nb_sessions} tmux session(s)"
echo " * ${nb_sessions_attached} attached"
tmux list-sessions | grep "attached" | sed -e 's/^/ - /'
echo " * ${nb_sessions_detached} detached"
tmux list-sessions | grep -v "attached" | sed -e 's/^/ - /'
fi
fi
fi