mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Some new notifications, mainly for active pane and current window and
session: pane-mode-changed window-pane-changed client-session-changed session-window-changed From Joshua Brot.
This commit is contained in:
@ -59,14 +59,27 @@ control_notify_input(struct client *c, struct window_pane *wp,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_pane_mode_changed(int pane)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
||||
continue;
|
||||
|
||||
control_write(c, "%%pane-mode-changed %%%u", pane);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_window_layout_changed(struct window *w)
|
||||
{
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
const char *template;
|
||||
char *cp;
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
const char *template;
|
||||
char *cp;
|
||||
|
||||
template = "%layout-change #{window_id} #{window_layout} "
|
||||
"#{window_visible_layout} #{window_flags}";
|
||||
@ -96,6 +109,20 @@ control_notify_window_layout_changed(struct window *w)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_window_pane_changed(struct window *w)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
||||
continue;
|
||||
|
||||
control_write(c, "%%window-pane-changed @%u %%%u", w->id,
|
||||
w->active->id);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_window_unlinked(__unused struct session *s, struct window *w)
|
||||
{
|
||||
@ -154,15 +181,27 @@ control_notify_window_renamed(struct window *w)
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_client_session_changed(struct client *c)
|
||||
control_notify_client_session_changed(struct client *cc)
|
||||
{
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
|
||||
if (cc->session == NULL)
|
||||
return;
|
||||
s = c->session;
|
||||
s = cc->session;
|
||||
|
||||
control_write(c, "%%session-changed $%u %s", s->id, s->name);
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
|
||||
continue;
|
||||
|
||||
if (cc == c) {
|
||||
control_write(c, "%%session-changed $%u %s", s->id,
|
||||
s->name);
|
||||
} else {
|
||||
control_write(c, "%%client-session-changed %s $%u %s",
|
||||
cc->name, s->id, s->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -203,3 +242,17 @@ control_notify_session_closed(__unused struct session *s)
|
||||
control_write(c, "%%sessions-changed");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_session_window_changed(struct session *s)
|
||||
{
|
||||
struct client *c;
|
||||
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
||||
continue;
|
||||
|
||||
control_write(c, "%%session-window-changed $%u @%u", s->id,
|
||||
s->curw->window->id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user