aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2017-06-09 09:21:24 +0000
committernicm <nicm>2017-06-09 09:21:24 +0000
commit74b2deae1ceb53efdf04f9fb6036586856724e1b (patch)
treeaf044d5e3041eea6ff67077d6c478706c9471136
parent8c4ae1c938b557f6cc9a6954aaa969dbba5e5d98 (diff)
downloadrtmux-74b2deae1ceb53efdf04f9fb6036586856724e1b.tar.gz
rtmux-74b2deae1ceb53efdf04f9fb6036586856724e1b.tar.bz2
rtmux-74b2deae1ceb53efdf04f9fb6036586856724e1b.zip
Add a hook when the clipboard is set.
-rw-r--r--input.c1
-rw-r--r--tmux.114
-rw-r--r--window-copy.c2
3 files changed, 13 insertions, 4 deletions
diff --git a/input.c b/input.c
index 8131c164..582c56f3 100644
--- a/input.c
+++ b/input.c
@@ -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/tmux.1 b/tmux.1
index 2d7be7c6..025adf69 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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/window-copy.c b/window-copy.c
index 31826861..3ad6084f 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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')