info-tmux-sessions: add script
This commit is contained in:
parent
7413d5c9ea
commit
d0a2935934
16
polybar-scripts/info-tmux-sessions/README.md
Normal file
16
polybar-scripts/info-tmux-sessions/README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Script: info-tmux-sessions
|
||||||
|
|
||||||
|
A simple script to show tmux sessions.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## Module
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[module/info-tmux-sessions]
|
||||||
|
type = custom/script
|
||||||
|
exec = ~/polybar-scripts/info-tmux-sessions.sh
|
||||||
|
interval = 5
|
||||||
|
```
|
21
polybar-scripts/info-tmux-sessions/info-tmux-sessions.sh
Executable file
21
polybar-scripts/info-tmux-sessions/info-tmux-sessions.sh
Executable 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
|
BIN
polybar-scripts/info-tmux-sessions/screenshots/1.png
Normal file
BIN
polybar-scripts/info-tmux-sessions/screenshots/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
polybar-scripts/info-tmux-sessions/screenshots/2.png
Normal file
BIN
polybar-scripts/info-tmux-sessions/screenshots/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Loading…
x
Reference in New Issue
Block a user