diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-10-10 10:02:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-10-10 10:02:48 +0000 |
commit | 9dd72b958366c44b6d62680836983c58d2a0a42f (patch) | |
tree | 6690d38f157a2e357c9aef70f72149f4ce244cae /cmd-list-sessions.c | |
parent | b7d031cc92a1d9ac3ca8c2a71b76b0a78ea77465 (diff) | |
download | rtmux-9dd72b958366c44b6d62680836983c58d2a0a42f.tar.gz rtmux-9dd72b958366c44b6d62680836983c58d2a0a42f.tar.bz2 rtmux-9dd72b958366c44b6d62680836983c58d2a0a42f.zip |
Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.
Had this around for a while, tested by a couple of people.
Diffstat (limited to 'cmd-list-sessions.c')
-rw-r--r-- | cmd-list-sessions.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 95c26567..cfa1433b 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -42,23 +42,32 @@ const struct cmd_entry cmd_list_sessions_entry = { int cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx) { - struct session *s; - char *tim; - u_int i; - time_t t; + struct session *s; + struct session_group *sg; + char *tim, tmp[64]; + u_int i, idx; + time_t t; for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { s = ARRAY_ITEM(&sessions, i); if (s == NULL) continue; + sg = session_group_find(s); + if (sg == NULL) + *tmp = '\0'; + else { + idx = session_group_index(sg); + xsnprintf(tmp, sizeof tmp, " (group %u)", idx); + } + t = s->tv.tv_sec; tim = ctime(&t); *strchr(tim, '\n') = '\0'; - ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s", + ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s%s", s->name, winlink_count(&s->windows), tim, s->sx, s->sy, - s->flags & SESSION_UNATTACHED ? "" : " (attached)"); + tmp, s->flags & SESSION_UNATTACHED ? "" : " (attached)"); } return (0); |