Thanks but I don't like this way of doing it.

I think this should work the same way as attach-session.

Take a look at the mail I just sent in the thread subject "patch
allowing attach to take and select a pane".

Both attach and switchc should work the same way, probably the way
suggested in that thread.

The alternative is that -w or -p or some other flag indicates -t is a
window or pane rather than a session, but this isn't as nice for the
user.


On Sun, Dec 08, 2013 at 11:25:57AM +0100, Johannes Jakobsson wrote:
> Add [-w window] to switch-client to specify which window in the 
> target-session to switch to.
> 
> //Johannes
> 
> >From d8efa53ec1104db86f4fd75be5a59d2317e7b673 Mon Sep 17 00:00:00 2001
> From: Johannes Jakobsson <johannes.jakobs...@gmail.com>
> Date: Sat, 7 Dec 2013 16:57:01 +0100
> Subject: [PATCH] '-w' option to switch-client
> 
> Example: switch-client -t s1 -w w1
> ---
>  cmd-switch-client.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd-switch-client.c b/cmd-switch-client.c
> index d101c52..68045c8 100644
> --- a/cmd-switch-client.c
> +++ b/cmd-switch-client.c
> @@ -32,8 +32,8 @@ enum cmd_retval      cmd_switch_client_exec(struct cmd *, 
> struct cmd_q *);
>  
>  const struct cmd_entry cmd_switch_client_entry = {
>       "switch-client", "switchc",
> -     "lc:npt:r", 0, 0,
> -     "[-lnpr] [-c target-client] [-t target-session]",
> +     "lc:npt:rw:", 0, 0,
> +     "[-lnpr] [-c target-client] [-t target-session] [-w window]",
>       CMD_READONLY,
>       cmd_switch_client_key_binding,
>       cmd_switch_client_exec
> @@ -62,6 +62,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
>       struct args     *args = self->args;
>       struct client   *c;
>       struct session  *s;
> +  struct winlink *wl;
>  
>       if ((c = cmd_find_client(cmdq, args_get(args, 'c'), 0)) == NULL)
>               return (CMD_RETURN_ERROR);
> @@ -99,6 +100,23 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q 
> *cmdq)
>       if (s == NULL)
>               return (CMD_RETURN_ERROR);
>  
> +  wl = NULL;
> +  if (args_has(args, 'w')) {
> +    /* Prepend the choosen session name in front of the
> +     * window name to make cmd_find_window work.
> +     */
> +    char *sw;
> +    const char *w_name = args_get(args, 'w');
> +    xasprintf(&sw, "%s:%s", s->name, w_name);
> +    wl = cmd_find_window(cmdq, sw, &s);
> +    free(sw);
> +    if (wl == NULL) {
> +                     cmdq_error(cmdq, "can't find window");
> +                     return (CMD_RETURN_ERROR);
> +    }
> +    session_set_current(s, wl);
> +  }
> +
>       if (c->session != NULL)
>               c->last_session = c->session;
>       c->session = s;
> -- 
> 1.8.3.2
> 
> 
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK 
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
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