summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-03-16 09:14:59 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-03-16 09:14:59 +0000
commit3869e66cf780741505223f01e1e5d86ed53252a1 (patch)
tree569eda6e8a360fcacd130004c5c408e2bde6dab5 /usr.bin
parentdd1675f5a0cf1e325de9ad02c9f71c6e5369fc93 (diff)
Add client-detached notification in control mode, from Mohsin Kaleem.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/control-notify.c13
-rw-r--r--usr.bin/tmux/notify.c4
-rw-r--r--usr.bin/tmux/tmux.16
-rw-r--r--usr.bin/tmux/tmux.h3
4 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/tmux/control-notify.c b/usr.bin/tmux/control-notify.c
index 5c8a9499b06..8cef39ae072 100644
--- a/usr.bin/tmux/control-notify.c
+++ b/usr.bin/tmux/control-notify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control-notify.c,v 1.28 2021/01/20 07:16:54 nicm Exp $ */
+/* $OpenBSD: control-notify.c,v 1.29 2021/03/16 09:14:58 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -172,6 +172,17 @@ control_notify_client_session_changed(struct client *cc)
}
void
+control_notify_client_detached(struct client *cc)
+{
+ struct client *c;
+
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (CONTROL_SHOULD_NOTIFY_CLIENT(c))
+ control_write(c, "%%client-detached %s", cc->name);
+ }
+}
+
+void
control_notify_session_renamed(struct session *s)
{
struct client *c;
diff --git a/usr.bin/tmux/notify.c b/usr.bin/tmux/notify.c
index 13b2ad38667..9bb6e4e8b82 100644
--- a/usr.bin/tmux/notify.c
+++ b/usr.bin/tmux/notify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: notify.c,v 1.36 2020/05/21 07:24:13 nicm Exp $ */
+/* $OpenBSD: notify.c,v 1.37 2021/03/16 09:14:58 nicm Exp $ */
/*
* Copyright (c) 2012 George Nachman <tmux@georgester.com>
@@ -126,6 +126,8 @@ notify_callback(struct cmdq_item *item, void *data)
control_notify_window_renamed(ne->window);
if (strcmp(ne->name, "client-session-changed") == 0)
control_notify_client_session_changed(ne->client);
+ if (strcmp(ne->name, "client-detached") == 0)
+ control_notify_client_detached(ne->client);
if (strcmp(ne->name, "session-renamed") == 0)
control_notify_session_renamed(ne->session);
if (strcmp(ne->name, "session-created") == 0)
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 3817d0db69e..8a665595a6a 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.829 2021/03/11 06:41:04 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.830 2021/03/16 09:14:58 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -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: March 11 2021 $
+.Dd $Mdocdate: March 16 2021 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -6107,6 +6107,8 @@ A notification will never occur inside an output block.
.Pp
The following notifications are defined:
.Bl -tag -width Ds
+.It Ic %client-detached Ar client
+The client has detached.
.It Ic %client-session-changed Ar client session-id name
The client is now attached to the session with ID
.Ar session-id ,
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index d363a1e770e..e3b23f0c931 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.1099 2021/03/11 07:08:18 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1100 2021/03/16 09:14:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2945,6 +2945,7 @@ 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 *);
void control_notify_client_session_changed(struct client *);
+void control_notify_client_detached(struct client *);
void control_notify_session_renamed(struct session *);
void control_notify_session_created(struct session *);
void control_notify_session_closed(struct session *);