From: nicm Date: Fri, 9 Jun 2017 09:21:24 +0000 (+0000) Subject: Add a hook when the clipboard is set. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8c303b1ff5917345176bdd029e34bc64642b93c7;p=openbsd Add a hook when the clipboard is set. --- diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 9359acb2a2b..d364321197c 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.125 2017/06/04 09:22:34 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.126 2017/06/09 09:21:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2174,6 +2174,7 @@ input_osc_52(struct window_pane *wp, const char *p) screen_write_start(&ctx, wp, NULL); screen_write_setselection(&ctx, out, outlen); screen_write_stop(&ctx); + notify_pane("pane-set-clipboard", wp); paste_add(out, outlen); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 00f59f2d06c..27eedebede3 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.559 2017/06/07 14:37:30 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.560 2017/06/09 09:21:24 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 7 2017 $ +.Dd $Mdocdate: June 9 2017 $ .Dt TMUX 1 .Os .Sh NAME @@ -2420,13 +2420,15 @@ The default is 100. .Op Ic on | external | off .Xc Attempt to set the terminal clipboard content using the -\ee]52;...\e007 .Xr xterm 1 -escape sequences, if there is an +escape sequence, if there is an .Em \&Ms entry in the .Xr terminfo 5 -description. +description (see the +.Sx TERMINFO EXTENSIONS +section). +.Pp If set to .Ic on , .Nm @@ -3230,7 +3232,7 @@ set-hook after-split-window "selectl even-vertical" .Ed .Pp In addition, the following hooks are available: -.Bl -tag -width "XXXXXXXXXXXXXXXX" +.Bl -tag -width "XXXXXXXXXXXXXXXXXXXXXX" .It alert-activity Run when a window has activity. See @@ -3255,6 +3257,10 @@ Run when the program running in a pane exits, but is on so the pane has not closed. .It pane-exited Run when the program running in a pane exits. +.It pane-set-clipboard +Run when the terminal clipboard is set using the +.Xr xterm 1 +escape sequence. .It session-created Run when a new session created. .It session-closed diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 25288d80ce3..3c8912dc858 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.178 2017/06/03 17:43:01 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.179 2017/06/09 09:21:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1633,6 +1633,7 @@ window_copy_copy_buffer(struct window_pane *wp, const char *bufname, void *buf, screen_write_start(&ctx, wp, NULL); screen_write_setselection(&ctx, buf, len); screen_write_stop(&ctx); + notify_pane("pane-set-clipboard", wp); } if (paste_set(buf, len, bufname, NULL) != 0) @@ -1690,6 +1691,7 @@ window_copy_append_selection(struct window_pane *wp, const char *bufname) screen_write_start(&ctx, wp, NULL); screen_write_setselection(&ctx, buf, len); screen_write_stop(&ctx); + notify_pane("pane-set-clipboard", wp); } if (bufname == NULL || *bufname == '\0')