home/config/polybar/scripts/info-tmux-sessions.sh

22 lines
398 B
Bash
Raw Normal View History

2020-11-17 13:58:04 +01:00
#! /bin/sh
if sessionlist=$(tmux ls 2>/dev/null); then
printf "# "
echo "$sessionlist" | while read -r line; do
session=$(echo "$line" | cut -d ':' -f 1)
if echo "$line" | grep -q "(attached)"; then
status="(a)"
else
status=""
fi
printf "%s%s " "$session" "$status"
done
printf "\n"
else
printf "# none\n"
fi