Try this please, which will let you do for example:

set -g status-left '#{?session_many_attached,yes,no}'

To show if a session is attached to multiple clients.

diff --git a/format.c b/format.c
index de6d8c8..c92a178 100644
--- a/format.c
+++ b/format.c
@@ -394,10 +394,8 @@ format_session(struct format_tree *ft, struct session *s)
        *strchr(tim, '\n') = '\0';
        format_add(ft, "session_created_string", "%s", tim);
 
-       if (s->flags & SESSION_UNATTACHED)
-               format_add(ft, "session_attached", "%d", 0);
-       else
-               format_add(ft, "session_attached", "%d", 1);
+       format_add(ft, "session_attached", "%u", s->attached);
+       format_add(ft, "session_many_attached", "%u", s->attached > 1);
 }
 
 /* Set default format keys for a client. */
diff --git a/resize.c b/resize.c
index 8d0bd27..b3b031c 100644
--- a/resize.c
+++ b/resize.c
@@ -55,6 +55,7 @@ recalculate_sizes(void)
        RB_FOREACH(s, sessions, &sessions) {
                has_status = options_get_number(&s->options, "status");
 
+               s->attached = 0;
                ssx = ssy = UINT_MAX;
                for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
                        c = ARRAY_ITEM(&clients, j);
@@ -69,6 +70,7 @@ recalculate_sizes(void)
                                        ssy = c->tty.sy - 1;
                                else if (c->tty.sy < ssy)
                                        ssy = c->tty.sy;
+                               s->attached++;
                        }
                }
                if (ssx == UINT_MAX || ssy == UINT_MAX) {
diff --git a/tmux.1 b/tmux.1
index 1146faf..43034c1 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3091,13 +3091,14 @@ The following variables are available, where 
appropriate:
 .It Li "saved_cursor_y" Ta "" Ta "Saved cursor Y in pane"
 .It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
 .It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
-.It Li "session_attached" Ta "" Ta "1 if session attached"
+.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
 .It Li "session_created" Ta "" Ta "Integer time session created"
 .It Li "session_created_string" Ta "" Ta "String time session created"
 .It Li "session_group" Ta "" Ta "Number of session group"
 .It Li "session_grouped" Ta "" Ta "1 if session in a group"
 .It Li "session_height" Ta "" Ta "Height of session"
 .It Li "session_id" Ta "" Ta "Unique session ID"
+.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
 .It Li "session_name" Ta "#S" Ta "Name of session"
 .It Li "session_width" Ta "" Ta "Width of session"
 .It Li "session_windows" Ta "" Ta "Number of windows in session"
diff --git a/tmux.h b/tmux.h
index dbc2c49..25bd14e 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1072,6 +1072,8 @@ struct session {
 #define SESSION_UNATTACHED 0x1 /* not attached to any clients */
        int              flags;
 
+       u_int            attached;
+
        struct termios  *tio;
 
        struct environ   environ;





On Tue, Dec 24, 2013 at 06:38:59PM +0100, hubert depesz lubaczewski wrote:
> On Tue, Dec 24, 2013 at 03:41:32PM +0000, Nicholas Marriott wrote:
> > Not at the moment but it probably wouldn't be too hard to add a format so 
> > you could do #{?whatever,&,}
> 
> That would be great. I usually see when other connect (since I have
> larger screen, so I get immediately lots of "dots" around), but it would
> really help in certain cases.
> 
> Now, that I think about it, another question - is it possible to have
> the same window display more for one client than another?
> 
> For example, I have 300x100 characters, and running tmux. When someone
> connects to this session, he would see only certain part of my pane, and
> I would still have the whole screen to work with/on?
> 
> Best regards,
> 
> depesz



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to