From b91086a5c80fd854f28f47d93aff5d85a886a7ff Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 13 Jul 2026 15:03:03 +0000 Subject: [PATCH] Add pane-activity event. --- input.c | 6 +++++- options-table.c | 3 ++- server-client.c | 5 +++-- tmux.1 | 11 +++-------- tmux.h | 3 ++- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/input.c b/input.c index 46e7b91aa..66f65e01c 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.267 2026/07/13 13:01:14 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.268 2026/07/13 15:03:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1051,6 +1051,10 @@ input_parse_buffer(struct window_pane *wp, const u_char *buf, size_t len) return; window_update_activity(wp->window); + if (~wp->flags & PANE_ACTIVITY) { + wp->flags |= PANE_ACTIVITY; + events_fire_pane("pane-activity", wp); + } wp->flags |= PANE_CHANGED; /* Flag new input while in a mode. */ diff --git a/options-table.c b/options-table.c index 3e8dd5b46..a36901dcb 100644 --- a/options-table.c +++ b/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.234 2026/07/13 13:01:14 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.235 2026/07/13 15:03:03 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1936,6 +1936,7 @@ const struct options_table_entry options_table[] = { OPTIONS_TABLE_HOOK("client-dark-theme", ""), OPTIONS_TABLE_HOOK("command-error", ""), OPTIONS_TABLE_HOOK("marked-pane-changed", ""), + OPTIONS_TABLE_PANE_HOOK("pane-activity", ""), OPTIONS_TABLE_PANE_HOOK("pane-bell", ""), OPTIONS_TABLE_PANE_HOOK("pane-command-finished", ""), OPTIONS_TABLE_PANE_HOOK("pane-command-started", ""), diff --git a/server-client.c b/server-client.c index 971b8d1aa..f28c80f85 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.487 2026/07/13 13:01:14 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.488 2026/07/13 15:03:03 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1812,7 +1812,8 @@ server_client_loop(void) server_client_check_pane_resize(wp); server_client_check_pane_buffer(wp); } - wp->flags &= ~(PANE_REDRAW|PANE_REDRAWSCROLLBAR); + wp->flags &= ~(PANE_REDRAW|PANE_REDRAWSCROLLBAR| + PANE_ACTIVITY); } check_window_name(w); } diff --git a/tmux.1 b/tmux.1 index 3b4b228f6..cddeaac3b 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.1134 2026/07/13 13:01:14 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.1135 2026/07/13 15:03:03 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -6378,17 +6378,12 @@ Run when a client switches to a dark theme. Run when a command fails. .It marked\-pane\-changed Run when the marked pane is set or cleared. +.It pane\-activity +Run when there is new output in a pane. .It pane\-bell Run when a pane receives a bell. .It pane\-command\-finished Run when an OSC 133 command finishes in a pane. -The event payload includes -.Ql hook_command_start_time , -.Ql hook_command_end_time , -.Ql hook_command_duration -and -.Ql hook_command_status -if present. .It pane\-command\-started Run when an OSC 133 command starts in a pane. .It pane\-created diff --git a/tmux.h b/tmux.h index db6d4cf4e..d954d6388 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1399 2026/07/13 13:01:14 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1400 2026/07/13 15:03:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1268,6 +1268,7 @@ struct window_pane { #define PANE_REDRAWSCROLLBAR 0x8000 #define PANE_DESTROYED 0x10000 #define PANE_CMDRUNNING 0x20000 +#define PANE_ACTIVITY 0x40000 bitstr_t *sync_dirty; u_int sync_dirty_size;