From: nicm Date: Tue, 12 May 2015 15:27:46 +0000 (+0000) Subject: Add bell-action "other" to pass through bells in all windows except the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d3bdd47402b3bb07078290c6c3a23beecd086490;p=openbsd Add bell-action "other" to pass through bells in all windows except the current, suggested by Jan ONDREJ. --- diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index fa45a6ea450..1920e0b6554 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.58 2015/05/11 10:58:22 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.59 2015/05/12 15:27:46 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -49,7 +49,7 @@ const char *options_table_status_position_list[] = { "top", "bottom", NULL }; const char *options_table_bell_action_list[] = { - "none", "any", "current", NULL + "none", "any", "current", "other", NULL }; /* Server options. */ diff --git a/usr.bin/tmux/server-window.c b/usr.bin/tmux/server-window.c index ddd1a0409a0..933b0b45f8f 100644 --- a/usr.bin/tmux/server-window.c +++ b/usr.bin/tmux/server-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-window.c,v 1.34 2015/04/24 23:17:11 nicm Exp $ */ +/* $OpenBSD: server-window.c,v 1.35 2015/05/12 15:27:46 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -77,13 +77,18 @@ server_window_check_bell(struct session *s, struct winlink *wl) if (c->session != s || c->flags & CLIENT_CONTROL) continue; if (!visual) { - if (c->session->curw->window == w || action == BELL_ANY) + if ((action == BELL_CURRENT && + c->session->curw->window == w) || + (action == BELL_OTHER && + c->session->curw->window != w) || + action == BELL_ANY) tty_bell(&c->tty); continue; } - if (c->session->curw->window == w) + if (action == BELL_CURRENT && c->session->curw->window == w) status_message_set(c, "Bell in current window"); - else if (action == BELL_ANY) + else if (action == BELL_ANY || (action == BELL_OTHER && + c->session->curw->window != w)) status_message_set(c, "Bell in window %d", wl->idx); } diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 99e46ffa2a9..a1271352dba 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.428 2015/05/11 10:10:16 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.429 2015/05/12 15:27:46 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: May 11 2015 $ +.Dd $Mdocdate: May 12 2015 $ .Dt TMUX 1 .Os .Sh NAME @@ -2375,16 +2375,18 @@ Set the base index from which an unused index should be searched when a new window is created. The default is zero. .It Xo Ic bell-action -.Op Ic any | none | current +.Op Ic any | none | current | other .Xc Set action on window bell. .Ic any means a bell in any window linked to a session causes a bell in the current window of that session, .Ic none -means all bells are ignored and +means all bells are ignored, .Ic current -means only bells in windows other than the current window are ignored. +means only bells in windows other than the current window are ignored and +.Ic other +means bells in the current window are ignored but not those in other windows. .It Xo Ic bell-on-alert .Op Ic on | off .Xc diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 72fa6b7e6d9..b1f5d4f1db2 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.512 2015/05/11 10:10:16 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.513 2015/05/12 15:27:46 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,6 +75,7 @@ extern char **environ; #define BELL_NONE 0 #define BELL_ANY 1 #define BELL_CURRENT 2 +#define BELL_OTHER 3 /* Special key codes. */ #define KEYC_NONE 0xfff