From 0dc5be0d12783760b1baa01644cf522c98db8898 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 4 Aug 2021 08:07:19 +0000 Subject: [PATCH] Add a client-active hook, from ncfavier in GitHub issue 2803. --- usr.bin/tmux/options-table.c | 3 ++- usr.bin/tmux/server-client.c | 4 +++- usr.bin/tmux/tmux.1 | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 172fc6bd282..c354804e775 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.146 2021/07/28 07:06:54 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.147 2021/08/04 08:07:19 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1145,6 +1145,7 @@ const struct options_table_entry options_table[] = { OPTIONS_TABLE_HOOK("alert-activity", ""), OPTIONS_TABLE_HOOK("alert-bell", ""), OPTIONS_TABLE_HOOK("alert-silence", ""), + OPTIONS_TABLE_HOOK("client-active", ""), OPTIONS_TABLE_HOOK("client-attached", ""), OPTIONS_TABLE_HOOK("client-detached", ""), OPTIONS_TABLE_HOOK("client-resized", ""), diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index a5604ab5171..949e25347f9 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.376 2021/07/21 08:06:36 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.377 2021/08/04 08:07:19 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1127,6 +1127,8 @@ server_client_update_latest(struct client *c) if (options_get_number(w->options, "window-size") == WINDOW_SIZE_LATEST) recalculate_size(w, 0); + + notify_client("client-active", c); } /* diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 61968db24c9..27d90bee37c 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.844 2021/06/18 07:46:54 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.845 2021/08/04 08:07:19 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 18 2021 $ +.Dd $Mdocdate: August 4 2021 $ .Dt TMUX 1 .Os .Sh NAME @@ -4396,6 +4396,8 @@ See Run when a window has been silent. See .Ic monitor-silence . +.It client-active +Run when a client becomes the latest active client of its session. .It client-attached Run when a client is attached. .It client-detached -- 2.20.1