Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/window-copy.c b/window-copy.c
- index b49be33..9537ad5 100644
- --- a/window-copy.c
- +++ b/window-copy.c
- @@ -23,6 +23,7 @@
- #include "tmux.h"
- +void to_pasteboard(char *buf);
- struct screen *window_copy_init(struct window_pane *);
- void window_copy_free(struct window_pane *);
- void window_copy_resize(struct window_pane *, u_int, u_int);
- @@ -143,6 +144,18 @@ struct window_copy_mode_data {
- char jumpchar;
- };
- +
- +void to_pasteboard(char *buf)
- +{
- + /* Copy to pasteboard */
- + FILE *fp;
- + fp = fopen("/tmp/tmux-buffer", "w");
- + fprintf(fp, "%s\0", buf);
- + fclose(fp);
- + system("reattach-to-user-namespace -l zsh -c \"pbcopy < /tmp/tmux-buffer\"");
- +}
- +
- +
- struct screen *
- window_copy_init(struct window_pane *wp)
- {
- @@ -1349,6 +1362,9 @@ window_copy_copy_selection(struct window_pane *wp)
- /* Add the buffer to the stack. */
- limit = options_get_number(&global_options, "buffer-limit");
- paste_add(&global_buffers, buf, off, limit);
- +
- + /* add by yusukei */
- + to_pasteboard(buf);
- }
- void
- @@ -1406,6 +1422,9 @@ window_copy_copy_line(struct window_pane *wp,
- *buf = xrealloc(*buf, 1, (*off) + 1);
- (*buf)[(*off)++] = '\n';
- }
- +
- + /* add by yusukei */
- + to_pasteboard(buf);
- }
- void
Add Comment
Please, Sign In to add comment