This commit is contained in:
parent
089efa795e
commit
98935dc9ba
1 changed files with 15 additions and 14 deletions
17
sh/tmux.sh
17
sh/tmux.sh
|
@ -54,17 +54,17 @@ rwx_tmux_server() {
|
||||||
--fields \"1\"
|
--fields \"1\"
|
||||||
}
|
}
|
||||||
rwx_tmux_servers() {
|
rwx_tmux_servers() {
|
||||||
local active=\"\$(rwx_tmux_server)\"
|
local active name root sockets text
|
||||||
local name path text
|
active=\"\$(rwx_tmux_server)\"
|
||||||
local paths=\"\$(lsof -U |
|
root=\"/tmp/tmux-\$(id -u)\"
|
||||||
awk \"/^tmux:.*\\(LISTEN\\)\$/ {print \\\$9}\")\"
|
sockets=\"\$(find \"\${root}\" -type s -printf \"%P\\n\")\"
|
||||||
while IFS= read -r path; do
|
while IFS= read -r name; do
|
||||||
name=\"\$(basename \"\${path}\")\"
|
if tmux -L \"\${name}\" list-sessions; then
|
||||||
text=\"\${text}\\
|
text=\"\${text}\\
|
||||||
#[fg=default]\\
|
#[fg=default]\\
|
||||||
#[bg=default] \\
|
#[bg=default] \\
|
||||||
\"
|
\"
|
||||||
if [ \"\${active}\" = \"\${name}\" ]; then
|
if [ \"\${name}\" = \"\${active}\" ]; then
|
||||||
text=\"\${text}#[fg=green]\"
|
text=\"\${text}#[fg=green]\"
|
||||||
else
|
else
|
||||||
text=\"\${text}#[fg=yellow]\"
|
text=\"\${text}#[fg=yellow]\"
|
||||||
|
@ -74,8 +74,9 @@ rwx_tmux_servers() {
|
||||||
#[bg=##282828]\${name}\\
|
#[bg=##282828]\${name}\\
|
||||||
#[bg=##181818] \\
|
#[bg=##181818] \\
|
||||||
\"
|
\"
|
||||||
|
fi
|
||||||
done <<EOF
|
done <<EOF
|
||||||
\${paths}
|
\${sockets}
|
||||||
EOF
|
EOF
|
||||||
echo \"\${text}\"
|
echo \"\${text}\"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue