What happens is that one session runs "~/tmuxtest.sh" and the second
sees it has been run and uses the same result. This is because they are
seen as the same job, because jobs are global. I don't think you will be
able to get this to work without changing tmux to either process formats
in the command before running it, or to treat jobs for different clients
as entirely separate. Alternatively set a different status-right for
each session when you create it.


On Mon, Jul 14, 2014 at 12:38:39PM -0400, Elliot Saba wrote:
>    Unfortunately, that doesn't seem to work. **I'm testing via the following:
> 
>    Put this in my .tmux.conf:
>    set -g status-right '#(~/tmuxtest.sh)'
>    set -g status-interval 1
> 
>    Put this in ~/tmuxtest.sh:
>    #!/bin/sh
>    tmux display-message -p "#S"
>    Then open up two separate tmux sessions, and you will see that the
>    display-message**command is just using the latest session created; which
>    is the default behavior of tmux when it has no explicit session
>    information, I believe.
>    -E
>    On Mon, Jul 14, 2014 at 9:57 AM, Nicholas Marriott
>    <[1]nicholas.marri...@gmail.com> wrote:
> 
>      You could try this and then see if display -p works:
> 
>      diff --git a/status.c b/status.c
>      index deb1b60..73d1f66 100644
>      --- a/status.c
>      +++ b/status.c
>      @@ -529,7 +529,7 @@ status_find_job(struct client *c, char **iptr)
> 
>      ** ** ** ** /* If not found at all, start the job and add to the tree.
>      */
>      ** ** ** ** if (so == NULL) {
>      - ** ** ** ** ** ** ** job_run(cmd, NULL, status_job_callback,
>      status_job_free, c);
>      + ** ** ** ** ** ** ** job_run(cmd, c->session, status_job_callback,
>      status_job_free, c);
>      ** ** ** ** ** ** ** ** c->references++;
> 
>      ** ** ** ** ** ** ** ** so = xmalloc(sizeof *so);
> 
>      On Tue, Jul 08, 2014 at 03:48:31PM -0700, Elliot Saba wrote:
>      > ** **Hello all,
>      >
>      > ** **I have a utility that is getting run from my tmux status bar, and
>      it needs
>      > ** **to know which session it's getting run from. **I tried passing
>      "#S" to the
>      > ** **command within "#()", but unfortunately it looks like the "#()"
>      gets run
>      > ** **before the "#S" gets replaced. **To be specific, if I put the
>      following
>      > ** **into my ~/.tmux.conf:
>      >
>      > ** **set -g status-right '#(echo the session is #S)'
>      >
>      > ** **echo gets called with arguments "the session is #S", which it
>      then
>      > ** **faithfully echoes, and then AFTER the echoing, the "#S" is parsed
>      into
>      > ** **session number. **Is there a way to get tmux to replace the #S
>      first?
>      >
>      > ** **I would just run something like "tmux display-message -p #S" from
>      within
>      > ** **the external command, but unfortunately it looks like the status
>      bar
>      > ** **commands are invoked from an environment that isn't linked to the
>      session
>      > ** **whose pane is currently updating its status bar.
>      >
>      > ** **Any pointers or tips would be helpful.
>      > ** **Thanks,
>      > ** **-E
> 
>      >
>      
> ------------------------------------------------------------------------------
>      > Open source business process management suite built on Java and
>      Eclipse
>      > Turn processes into business applications with Bonita BPM Community
>      Edition
>      > Quickly connect people, data, and systems into organized workflows
>      > Winner of BOSSIE, CODIE, OW2 and Gartner awards
>      > [2]http://p.sf.net/sfu/Bonitasoft
> 
>      > _______________________________________________
>      > tmux-users mailing list
>      > [3]tmux-users@lists.sourceforge.net
>      > [4]https://lists.sourceforge.net/lists/listinfo/tmux-users
> 
> References
> 
>    Visible links
>    1. mailto:nicholas.marri...@gmail.com
>    2. http://p.sf.net/sfu/Bonitasoft
>    3. mailto:tmux-users@lists.sourceforge.net
>    4. https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to