From 42490f4750bb6f39c08908e8e7a3b85022a077af 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. --- options-table.c | 1 + server-client.c | 2 ++ tmux.1 | 2 ++ 3 files changed, 5 insertions(+) diff --git a/options-table.c b/options-table.c index bca529cf..a4b85fd2 100644 --- a/options-table.c +++ b/options-table.c @@ -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/server-client.c b/server-client.c index 1be3575e..4c7def8f 100644 --- a/server-client.c +++ b/server-client.c @@ -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/tmux.1 b/tmux.1 index dd25edfc..0abb4c76 100644 --- a/tmux.1 +++ b/tmux.1 @@ -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