info-tmux-sessions: add script

This commit is contained in:
Guy Gastineau 2019-02-01 17:47:06 -05:00 committed by x70b1
parent 7413d5c9ea
commit d0a2935934
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,16 @@
# Script: info-tmux-sessions
A simple script to show tmux sessions.
![info-tmux-sessions](screenshots/1.png)
![info-tmux-sessions](screenshots/2.png)
## Module
```ini
[module/info-tmux-sessions]
type = custom/script
exec = ~/polybar-scripts/info-tmux-sessions.sh
interval = 5
```

View File

@ -0,0 +1,21 @@
#! /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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB