-
Notifications
You must be signed in to change notification settings - Fork 3
/
zc-logo-all
35 lines (27 loc) · 1011 Bytes
/
zc-logo-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
setopt localoptions extendedglob clobber
integer idx is_locked counter=0
local busyfile busywith
if [[ "$1" = "-h" || "$1" = "--help" ]]; then
__zconvey_pinfo "Sends zc-logo or zc-id to all terminals (the latter when argument \"text\" is passed)"
return 0
fi
for (( idx = 1; idx <= 100; idx ++ )); do
name=""
busywith=""
is_locked=0
__zconvey_is_session_active "$idx" && is_locked=1 || is_locked=0
if (( is_locked )); then
busyfile="$ZCONVEY_OTHER_DIR/${idx}.busy"
if [[ -e "$busyfile" && "$idx" != "$ZCONVEY_ID" ]]; then
busywith="\033[1;33m$(<$busyfile)\033[0m"
__zconvey_get_name_of_id "$idx"
print "Session $idx (name: $REPLY) busy ($busywith), no logo request for it"
else
counter+=1
[ "$1" = "text" ] && zc -qi "$idx" zc-id || zc -qi "$idx" zc-logo \&\& sleep 18
fi
fi
done
__zconvey_pinfo "Sent logo request to $counter sessions, including this one"
return 0
# vim:ft=zsh