mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Status bar sync
This commit is contained in:
parent
64fe4acb9c
commit
9c5df60d62
2
server.c
2
server.c
@ -506,7 +506,9 @@ server_second_callback(unused int fd, unused short events, unused void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TMATE_SLAVE
|
||||||
server_client_status_timer();
|
server_client_status_timer();
|
||||||
|
#endif
|
||||||
|
|
||||||
evtimer_del(&server_ev_second);
|
evtimer_del(&server_ev_second);
|
||||||
memset(&tv, 0, sizeof tv);
|
memset(&tv, 0, sizeof tv);
|
||||||
|
9
status.c
9
status.c
@ -28,6 +28,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
#include "tmate.h"
|
||||||
|
|
||||||
char *status_redraw_get_left(
|
char *status_redraw_get_left(
|
||||||
struct client *, time_t, int, struct grid_cell *, size_t *);
|
struct client *, time_t, int, struct grid_cell *, size_t *);
|
||||||
@ -94,8 +95,12 @@ status_redraw_get_left(struct client *c,
|
|||||||
if (attr != 0)
|
if (attr != 0)
|
||||||
gc->attr = attr;
|
gc->attr = attr;
|
||||||
|
|
||||||
|
#ifdef TMATE_SLAVE
|
||||||
|
left = xstrdup(tmate_left_status ?: "");
|
||||||
|
#else
|
||||||
left = status_replace(c, NULL,
|
left = status_replace(c, NULL,
|
||||||
NULL, NULL, options_get_string(&s->options, "status-left"), t, 1);
|
NULL, NULL, options_get_string(&s->options, "status-left"), t, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
*size = options_get_number(&s->options, "status-left-length");
|
*size = options_get_number(&s->options, "status-left-length");
|
||||||
leftlen = screen_write_cstrlen(utf8flag, "%s", left);
|
leftlen = screen_write_cstrlen(utf8flag, "%s", left);
|
||||||
@ -124,8 +129,12 @@ status_redraw_get_right(struct client *c,
|
|||||||
if (attr != 0)
|
if (attr != 0)
|
||||||
gc->attr = attr;
|
gc->attr = attr;
|
||||||
|
|
||||||
|
#ifdef TMATE_SLAVE
|
||||||
|
right = xstrdup(tmate_right_status ?: "");
|
||||||
|
#else
|
||||||
right = status_replace(c, NULL,
|
right = status_replace(c, NULL,
|
||||||
NULL, NULL, options_get_string(&s->options, "status-right"), t, 1);
|
NULL, NULL, options_get_string(&s->options, "status-right"), t, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
*size = options_get_number(&s->options, "status-right-length");
|
*size = options_get_number(&s->options, "status-right-length");
|
||||||
rightlen = screen_write_cstrlen(utf8flag, "%s", right);
|
rightlen = screen_write_cstrlen(utf8flag, "%s", right);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "tmate.h"
|
#include "tmate.h"
|
||||||
|
|
||||||
|
char *tmate_left_status, *tmate_right_status;
|
||||||
|
|
||||||
static struct session *main_session;
|
static struct session *main_session;
|
||||||
|
|
||||||
struct tmate_unpacker {
|
struct tmate_unpacker {
|
||||||
@ -227,6 +229,20 @@ out:
|
|||||||
free(cmd_str);
|
free(cmd_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tmate_status(struct tmate_unpacker *uk)
|
||||||
|
{
|
||||||
|
struct client *c;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
free(tmate_left_status);
|
||||||
|
free(tmate_right_status);
|
||||||
|
tmate_left_status = unpack_string(uk);
|
||||||
|
tmate_right_status = unpack_string(uk);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++)
|
||||||
|
ARRAY_ITEM(&clients, i)->flags |= CLIENT_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_message(msgpack_object obj)
|
static void handle_message(msgpack_object obj)
|
||||||
{
|
{
|
||||||
struct tmate_unpacker _uk;
|
struct tmate_unpacker _uk;
|
||||||
@ -240,6 +256,7 @@ static void handle_message(msgpack_object obj)
|
|||||||
case TMATE_SYNC_WINDOW: tmate_sync_window(uk); break;
|
case TMATE_SYNC_WINDOW: tmate_sync_window(uk); break;
|
||||||
case TMATE_PTY_DATA: tmate_pty_data(uk); break;
|
case TMATE_PTY_DATA: tmate_pty_data(uk); break;
|
||||||
case TMATE_CMD: tmate_cmd(uk); break;
|
case TMATE_CMD: tmate_cmd(uk); break;
|
||||||
|
case TMATE_STATUS: tmate_status(uk); break;
|
||||||
default: decoder_error();
|
default: decoder_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
tmate.h
3
tmate.h
@ -42,11 +42,14 @@ extern int tmate_should_exec_cmd_locally(const struct cmd_entry *cmd);
|
|||||||
#define TMATE_HLIMIT 1000
|
#define TMATE_HLIMIT 1000
|
||||||
#define TMATE_MAX_MESSAGE_SIZE (16*1024)
|
#define TMATE_MAX_MESSAGE_SIZE (16*1024)
|
||||||
|
|
||||||
|
extern char *tmate_left_status, *tmate_right_status;
|
||||||
|
|
||||||
enum tmate_commands {
|
enum tmate_commands {
|
||||||
TMATE_HEADER,
|
TMATE_HEADER,
|
||||||
TMATE_SYNC_WINDOW,
|
TMATE_SYNC_WINDOW,
|
||||||
TMATE_PTY_DATA,
|
TMATE_PTY_DATA,
|
||||||
TMATE_CMD,
|
TMATE_CMD,
|
||||||
|
TMATE_STATUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TMATE_PANE_ACTIVE 1
|
#define TMATE_PANE_ACTIVE 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user