1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-10-06 20:22:52 +00:00
Dotfiles/.config/polybar/polybar-scripts/info-tmux-sessions/info-tmux-sessions.sh
2020-07-27 07:59:00 +03:00

22 lines
386 B
Bash

#! /bin/sh
if sessionlist=$(tmux ls); 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