mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		@@ -129,6 +129,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item)
 | 
			
		||||
	if (~item->shared->flags & CMDQ_SHARED_REPEAT)
 | 
			
		||||
		server_client_set_key_table(c, NULL);
 | 
			
		||||
	status_timer_start(c);
 | 
			
		||||
	notify_client("client-session-changed", c);
 | 
			
		||||
	session_update_activity(s, NULL);
 | 
			
		||||
	gettimeofday(&s->last_attached_time, NULL);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								notify.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								notify.c
									
									
									
									
									
								
							@@ -78,8 +78,12 @@ notify_callback(struct cmdq_item *item, void *data)
 | 
			
		||||
 | 
			
		||||
	log_debug("%s: %s", __func__, ne->name);
 | 
			
		||||
 | 
			
		||||
	if (strcmp(ne->name, "pane-mode-changed") == 0)
 | 
			
		||||
		control_notify_pane_mode_changed(ne->pane);
 | 
			
		||||
	if (strcmp(ne->name, "window-layout-changed") == 0)
 | 
			
		||||
		control_notify_window_layout_changed(ne->window);
 | 
			
		||||
	if (strcmp(ne->name, "window-pane-changed") == 0)
 | 
			
		||||
		control_notify_window_pane_changed(ne->window);
 | 
			
		||||
	if (strcmp(ne->name, "window-unlinked") == 0)
 | 
			
		||||
		control_notify_window_unlinked(ne->session, ne->window);
 | 
			
		||||
	if (strcmp(ne->name, "window-linked") == 0)
 | 
			
		||||
@@ -94,6 +98,8 @@ notify_callback(struct cmdq_item *item, void *data)
 | 
			
		||||
		control_notify_session_created(ne->session);
 | 
			
		||||
	if (strcmp(ne->name, "session-closed") == 0)
 | 
			
		||||
		control_notify_session_closed(ne->session);
 | 
			
		||||
	if (strcmp(ne->name, "session-window-changed") == 0)
 | 
			
		||||
		control_notify_session_window_changed(ne->session);
 | 
			
		||||
 | 
			
		||||
	notify_hook(item, ne);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -552,6 +552,7 @@ session_set_current(struct session *s, struct winlink *wl)
 | 
			
		||||
	s->curw = wl;
 | 
			
		||||
	winlink_clear_flags(wl);
 | 
			
		||||
	window_update_activity(wl->window);
 | 
			
		||||
	notify_session("session-window-changed", s);
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								tmux.1
									
									
									
									
									
								
							@@ -4237,6 +4237,11 @@ A notification will never occur inside an output block.
 | 
			
		||||
.Pp
 | 
			
		||||
The following notifications are defined:
 | 
			
		||||
.Bl -tag -width Ds
 | 
			
		||||
.It Ic %client-session-changed Ar client Ar session-id Ar name
 | 
			
		||||
The client is now attached to the session with ID
 | 
			
		||||
.Ar session-id ,
 | 
			
		||||
which is named
 | 
			
		||||
.Ar name .
 | 
			
		||||
.It Ic %exit Op Ar reason
 | 
			
		||||
The
 | 
			
		||||
.Nm
 | 
			
		||||
@@ -4259,6 +4264,10 @@ and the window flags are
 | 
			
		||||
A window pane produced output.
 | 
			
		||||
.Ar value
 | 
			
		||||
escapes non-printable characters and backslash as octal \\xxx.
 | 
			
		||||
.It Ic %pane-mode-changed Ar pane-id
 | 
			
		||||
The pane with ID
 | 
			
		||||
.Ar pane-id
 | 
			
		||||
has changed mode.
 | 
			
		||||
.It Ic %session-changed Ar session-id Ar name
 | 
			
		||||
The client is now attached to the session with ID
 | 
			
		||||
.Ar session-id ,
 | 
			
		||||
@@ -4267,6 +4276,11 @@ which is named
 | 
			
		||||
.It Ic %session-renamed Ar name
 | 
			
		||||
The current session was renamed to
 | 
			
		||||
.Ar name .
 | 
			
		||||
.It Ic %session-window-changed Ar session-id Ar window-id
 | 
			
		||||
The session with ID
 | 
			
		||||
.Ar session-id
 | 
			
		||||
changed its active window to the window with ID
 | 
			
		||||
.Ar window-id .
 | 
			
		||||
.It Ic %sessions-changed
 | 
			
		||||
A session was created or destroyed.
 | 
			
		||||
.It Ic %unlinked-window-add Ar window-id
 | 
			
		||||
@@ -4281,6 +4295,11 @@ was linked to the current session.
 | 
			
		||||
The window with ID
 | 
			
		||||
.Ar window-id
 | 
			
		||||
closed.
 | 
			
		||||
.It Ic %window-pane-changed Ar window-id Ar pane-id
 | 
			
		||||
The active pane in the window with ID
 | 
			
		||||
.Ar window-id
 | 
			
		||||
changed to the pane with ID
 | 
			
		||||
.Ar pane-id .
 | 
			
		||||
.It Ic %window-renamed Ar window-id Ar name
 | 
			
		||||
The window with ID
 | 
			
		||||
.Ar window-id
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -2212,7 +2212,9 @@ void	control_write_buffer(struct client *, struct evbuffer *);
 | 
			
		||||
/* control-notify.c */
 | 
			
		||||
void	control_notify_input(struct client *, struct window_pane *,
 | 
			
		||||
	    struct evbuffer *);
 | 
			
		||||
void	control_notify_pane_mode_changed(int);
 | 
			
		||||
void	control_notify_window_layout_changed(struct window *);
 | 
			
		||||
void	control_notify_window_pane_changed(struct window *);
 | 
			
		||||
void	control_notify_window_unlinked(struct session *, struct window *);
 | 
			
		||||
void	control_notify_window_linked(struct session *, struct window *);
 | 
			
		||||
void	control_notify_window_renamed(struct window *);
 | 
			
		||||
@@ -2220,6 +2222,7 @@ void	control_notify_client_session_changed(struct client *);
 | 
			
		||||
void	control_notify_session_renamed(struct session *);
 | 
			
		||||
void	control_notify_session_created(struct session *);
 | 
			
		||||
void	control_notify_session_closed(struct session *);
 | 
			
		||||
void	control_notify_session_window_changed(struct session *);
 | 
			
		||||
 | 
			
		||||
/* session.c */
 | 
			
		||||
extern struct sessions sessions;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								window.c
									
									
									
									
									
								
							@@ -355,6 +355,8 @@ window_create_spawn(const char *name, int argc, char **argv, const char *path,
 | 
			
		||||
	} else
 | 
			
		||||
		w->name = default_window_name(w);
 | 
			
		||||
 | 
			
		||||
	notify_window("window-pane-changed", w);
 | 
			
		||||
 | 
			
		||||
	return (w);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -441,11 +443,14 @@ window_set_active_pane(struct window *w, struct window_pane *wp)
 | 
			
		||||
		w->active = TAILQ_PREV(w->active, window_panes, entry);
 | 
			
		||||
		if (w->active == NULL)
 | 
			
		||||
			w->active = TAILQ_LAST(&w->panes, window_panes);
 | 
			
		||||
		if (w->active == wp)
 | 
			
		||||
		if (w->active == wp) {
 | 
			
		||||
			notify_window("window-pane-changed", w);
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	w->active->active_point = next_active_point++;
 | 
			
		||||
	w->active->flags |= PANE_CHANGED;
 | 
			
		||||
	notify_window("window-pane-changed", w);
 | 
			
		||||
	return (1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -621,8 +626,10 @@ window_lost_pane(struct window *w, struct window_pane *wp)
 | 
			
		||||
			if (w->active == NULL)
 | 
			
		||||
				w->active = TAILQ_NEXT(wp, entry);
 | 
			
		||||
		}
 | 
			
		||||
		if (w->active != NULL)
 | 
			
		||||
		if (w->active != NULL) {
 | 
			
		||||
			w->active->flags |= PANE_CHANGED;
 | 
			
		||||
			notify_window("window-pane-changed", w);
 | 
			
		||||
		}
 | 
			
		||||
	} else if (wp == w->last)
 | 
			
		||||
		w->last = NULL;
 | 
			
		||||
}
 | 
			
		||||
@@ -1196,6 +1203,7 @@ window_pane_set_mode(struct window_pane *wp, const struct window_mode *mode)
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_CHANGED);
 | 
			
		||||
 | 
			
		||||
	server_status_window(wp->window);
 | 
			
		||||
	notify_pane("pane-mode-changed", wp);
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1215,6 +1223,7 @@ window_pane_reset_mode(struct window_pane *wp)
 | 
			
		||||
	wp->flags |= (PANE_REDRAW|PANE_CHANGED);
 | 
			
		||||
 | 
			
		||||
	server_status_window(wp->window);
 | 
			
		||||
	notify_pane("pane-mode-changed", wp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user