Ooops, I missed that functionality... In that case - just ignore my patch ;).
Rytis. On Tue, Jul 11, 2017 at 12:15 AM, Nicholas Marriott < [email protected]> wrote: > How is this different from synchronize-panes? > > > On Tue, Jul 11, 2017 at 12:11:44AM +0300, Rytis Karpuska wrote: > > Hey, > > > > I often need to do some work in a cluster of linux servers, therefore > > it would be very convenient if tmux could duplicate input to all panes > > of current window. This patch adds this functionality togglable with > > command. Hopefully it will be helpful for other people also :). > > > > Rytis. > > > > --- > > Makefile.am | 1 + > > cmd-toggle-duplicate-stdin.c | 50 ++++++++++++++++++++++++++++++ > ++++++++++++++ > > cmd.c | 3 +++ > > server-client.c | 10 ++++++++- > > tmux.1 | 2 ++ > > tmux.h | 1 + > > 6 files changed, 66 insertions(+), 1 deletion(-) > > create mode 100644 cmd-toggle-duplicate-stdin.c > > > > diff --git a/Makefile.am b/Makefile.am > > index bdc752c..bf5e02a 100644 > > --- a/Makefile.am > > +++ b/Makefile.am > > @@ -124,6 +124,7 @@ dist_tmux_SOURCES = \ > > cmd-switch-client.c \ > > cmd-unbind-key.c \ > > cmd-wait-for.c \ > > + cmd-toggle-duplicate-stdin.c \ > > cmd.c \ > > colour.c \ > > compat.h \ > > diff --git a/cmd-toggle-duplicate-stdin.c b/cmd-toggle-duplicate-stdin.c > > new file mode 100644 > > index 0000000..e5fd402 > > --- /dev/null > > +++ b/cmd-toggle-duplicate-stdin.c > > @@ -0,0 +1,50 @@ > > +/* $OpenBSD$ */ > > + > > +/* > > + * Copyright (c) 2017 Rytis Karpuska <[email protected]> > > + * > > + * Permission to use, copy, modify, and distribute this software for any > > + * purpose with or without fee is hereby granted, provided that the > above > > + * copyright notice and this permission notice appear in all copies. > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL > WARRANTIES > > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE > FOR > > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY > DAMAGES > > + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER > > + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > ARISING > > + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > + */ > > + > > +#include <sys/types.h> > > + > > +#include "tmux.h" > > + > > +/* > > + * Toggle stdin duplication to all panes of current window. > > + */ > > + > > +static enum cmd_retval cmd_toggle_duplicate_stdin_exec(struct > cmd *, struct cmdq_item *); > > + > > +const struct cmd_entry cmd_toggle_duplicate_stdin_entry = { > > + .name = "toggle-duplicate-stdin", > > + .alias = NULL, > > + > > + .args = { "", 0, 0}, > > + .usage = "", > > + > > + .target = { 't', CMD_FIND_WINDOW, 0 }, > > + > > + .flags = 0, > > + .exec = cmd_toggle_duplicate_stdin_exec > > +}; > > + > > +static enum cmd_retval > > +cmd_toggle_duplicate_stdin_exec(struct cmd *self __unused, struct > cmdq_item *item) > > +{ > > + struct window *w = item->target.w; > > + w->flags = w->flags ^ WINDOW_DUPLICATE_STDIN; > > + > > + return (CMD_RETURN_NORMAL); > > +} > > + > > diff --git a/cmd.c b/cmd.c > > index 45f83c2..26a0636 100644 > > --- a/cmd.c > > +++ b/cmd.c > > @@ -112,6 +112,8 @@ extern const struct cmd_entry cmd_unbind_key_entry; > > extern const struct cmd_entry cmd_unlink_window_entry; > > extern const struct cmd_entry cmd_up_pane_entry; > > extern const struct cmd_entry cmd_wait_for_entry; > > +extern const struct cmd_entry cmd_toggle_duplicate_stdin_entry; > > + > > > > const struct cmd_entry *cmd_table[] = { > > &cmd_attach_session_entry, > > @@ -197,6 +199,7 @@ const struct cmd_entry *cmd_table[] = { > > &cmd_unbind_key_entry, > > &cmd_unlink_window_entry, > > &cmd_wait_for_entry, > > + &cmd_toggle_duplicate_stdin_entry, > > NULL > > }; > > > > diff --git a/server-client.c b/server-client.c > > index 1fd6eb6..4fa9c34 100644 > > --- a/server-client.c > > +++ b/server-client.c > > @@ -1000,8 +1000,16 @@ retry: > > forward: > > if (c->flags & CLIENT_READONLY) > > return; > > - if (wp != NULL) > > + if (w->flags & WINDOW_DUPLICATE_STDIN) > > + { > > + TAILQ_FOREACH(wp, &w->panes, entry) { > > + window_pane_key(wp, c, s, key, m); > > + } > > + } > > + else if (wp != NULL) > > + { > > window_pane_key(wp, c, s, key, m); > > + } > > } > > > > /* Client functions that need to happen every loop. */ > > diff --git a/tmux.1 b/tmux.1 > > index da97dd7..c6c782c 100644 > > --- a/tmux.1 > > +++ b/tmux.1 > > @@ -2076,6 +2076,8 @@ if > > .Fl k > > is specified and the window is linked to only one session, it is > unlinked and > > destroyed. > > +.It Ic toggle-duplicate-stdin > > +Toggle duplication of input to all panes of current window. Useful for > interactively executing identical commands in several terminal sessions. > > .El > > .Sh KEY BINDINGS > > .Nm > > diff --git a/tmux.h b/tmux.h > > index 7b79544..e5437bc 100644 > > --- a/tmux.h > > +++ b/tmux.h > > @@ -857,6 +857,7 @@ struct window { > > #define WINDOW_FORCEHEIGHT 0x4000 > > #define WINDOW_STYLECHANGED 0x8000 > > #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) > > +#define WINDOW_DUPLICATE_STDIN 0x10000 > > > > int alerts_queued; > > TAILQ_ENTRY(window) alerts_entry; > > -- > > 2.7.4 > > > > -- > > You received this message because you are subscribed to the Google > Groups "tmux-users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To post to this group, send an email to [email protected]. > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
