diff --git a/status.c b/status.c index f120c38a..f7a3420e 100644 --- a/status.c +++ b/status.c @@ -28,6 +28,7 @@ #include #include "tmux.h" +#include "tmate.h" char *status_redraw_get_left( struct client *, time_t, int, struct grid_cell *, size_t *); @@ -206,6 +207,8 @@ status_redraw(struct client *c) memcpy(&rgc, &stdgc, sizeof rgc); right = status_redraw_get_right(c, t, utf8flag, &rgc, &rlen); + tmate_status(left, right); + /* * Figure out how much space we have for the window list. If there * isn't enough space, just show a blank status line. diff --git a/tmate-encoder.c b/tmate-encoder.c index 6995371c..976edc36 100644 --- a/tmate-encoder.c +++ b/tmate-encoder.c @@ -110,3 +110,22 @@ void tmate_cmd(const char *cmd) pack(int, TMATE_CMD); pack(string, cmd); } + +void tmate_status(const char *left, const char *right) +{ + static char *old_left, *old_right; + + if (old_left && !strcmp(old_left, left) && + old_right && !strcmp(old_right, right)) + return; + + pack(array, 3); + pack(int, TMATE_STATUS); + pack(string, left); + pack(string, right); + + free(old_left); + free(old_right); + old_left = xstrdup(left); + old_right = xstrdup(right); +} diff --git a/tmate.h b/tmate.h index 13defe29..46800aa5 100644 --- a/tmate.h +++ b/tmate.h @@ -23,6 +23,7 @@ enum tmate_commands { TMATE_SYNC_WINDOW, TMATE_PTY_DATA, TMATE_CMD, + TMATE_STATUS, }; struct tmate_encoder { @@ -38,6 +39,7 @@ extern void tmate_sync_window(struct window *w); extern void tmate_pty_data(struct window_pane *wp, const char *buf, size_t len); extern int tmate_should_replicate_cmd(const struct cmd_entry *cmd); extern void tmate_cmd(const char *cmd); +extern void tmate_status(const char *left, const char *right); /* tmate-decoder.c */