tmux/servers,sockets
All checks were successful
/ job (push) Successful in 3m9s

This commit is contained in:
Marc Beninca 2025-07-22 20:53:49 +02:00
parent 089efa795e
commit 98935dc9ba
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -54,17 +54,17 @@ rwx_tmux_server() {
--fields \"1\"
}
rwx_tmux_servers() {
local active=\"\$(rwx_tmux_server)\"
local name path text
local paths=\"\$(lsof -U |
awk \"/^tmux:.*\\(LISTEN\\)\$/ {print \\\$9}\")\"
while IFS= read -r path; do
name=\"\$(basename \"\${path}\")\"
local active name root sockets text
active=\"\$(rwx_tmux_server)\"
root=\"/tmp/tmux-\$(id -u)\"
sockets=\"\$(find \"\${root}\" -type s -printf \"%P\\n\")\"
while IFS= read -r name; do
if tmux -L \"\${name}\" list-sessions; then
text=\"\${text}\\
#[fg=default]\\
#[bg=default] \\
\"
if [ \"\${active}\" = \"\${name}\" ]; then
if [ \"\${name}\" = \"\${active}\" ]; then
text=\"\${text}#[fg=green]\"
else
text=\"\${text}#[fg=yellow]\"
@ -74,8 +74,9 @@ rwx_tmux_servers() {
#[bg=##282828]\${name}\\
#[bg=##181818] \\
\"
fi
done <<EOF
\${paths}
\${sockets}
EOF
echo \"\${text}\"
}