This allows for hooks to run when a bell is sounded by tmux.
---
 server-window.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/server-window.c b/server-window.c
index 4f5a550..99c25eb 100644
--- a/server-window.c
+++ b/server-window.c
@@ -88,7 +88,7 @@ server_window_check_bell(struct session *s, struct winlink 
*wl)
                if (c == NULL || c->session != s || (c->flags & CLIENT_CONTROL))
                        continue;
                if (!visual) {
-                       tty_bell(&c->tty);
+                       ring_bell(s);
                        continue;
                }
                if (c->session->curw->window == w)
@@ -238,11 +238,18 @@ void
 ring_bell(struct session *s)
 {
        struct client   *c;
+       struct hooks    *hooks;
+       struct hook     *h;
        u_int            i;
 
        for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                c = ARRAY_ITEM(&clients, i);
-               if (c != NULL && c->session == s && !(c->flags & 
CLIENT_CONTROL))
+               if (c != NULL && c->session == s && !(c->flags & 
CLIENT_CONTROL)) {
                        tty_bell(&c->tty);
+                       hooks = s != NULL ? &s->hooks : &global_hooks;
+                       if ((h = hooks_find(hooks, "on-bell")) != NULL)
+                               hooks_run(h, c->cmdq);
+               }
+
        }
 }
-- 
1.7.11.4


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to