mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 10:28:48 +00:00
Sync OpenBSD patchset 929:
Add an option to trigger the terminal bell when there is an alert, from Marco Beck.
This commit is contained in:
parent
fce026eb32
commit
8144e5cb7e
@ -1,4 +1,4 @@
|
|||||||
/* $Id: options-table.c,v 1.12 2011-05-22 16:26:09 tcunha Exp $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -97,6 +97,11 @@ const struct options_table_entry session_options_table[] = {
|
|||||||
.default_num = BELL_ANY
|
.default_num = BELL_ANY
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ .name = "bell-on-alert",
|
||||||
|
.type = OPTIONS_TABLE_FLAG,
|
||||||
|
.default_num = 0
|
||||||
|
},
|
||||||
|
|
||||||
{ .name = "default-command",
|
{ .name = "default-command",
|
||||||
.type = OPTIONS_TABLE_STRING,
|
.type = OPTIONS_TABLE_STRING,
|
||||||
.default_str = ""
|
.default_str = ""
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server-window.c,v 1.20 2011-02-15 15:20:38 tcunha Exp $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -28,6 +28,7 @@ int server_window_check_activity(struct session *, struct winlink *);
|
|||||||
int server_window_check_silence(struct session *, struct winlink *);
|
int server_window_check_silence(struct session *, struct winlink *);
|
||||||
int server_window_check_content(
|
int server_window_check_content(
|
||||||
struct session *, struct winlink *, struct window_pane *);
|
struct session *, struct winlink *, struct window_pane *);
|
||||||
|
void ring_bell(struct session *);
|
||||||
|
|
||||||
/* Window functions that need to happen every loop. */
|
/* Window functions that need to happen every loop. */
|
||||||
void
|
void
|
||||||
@ -134,6 +135,8 @@ server_window_check_activity(struct session *s, struct winlink *wl)
|
|||||||
if (!options_get_number(&w->options, "monitor-activity"))
|
if (!options_get_number(&w->options, "monitor-activity"))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
if (options_get_number(&s->options, "bell-on-alert"))
|
||||||
|
ring_bell(s);
|
||||||
wl->flags |= WINLINK_ACTIVITY;
|
wl->flags |= WINLINK_ACTIVITY;
|
||||||
|
|
||||||
if (options_get_number(&s->options, "visual-activity")) {
|
if (options_get_number(&s->options, "visual-activity")) {
|
||||||
@ -183,6 +186,9 @@ server_window_check_silence(struct session *s, struct winlink *wl)
|
|||||||
timer_difference = timer.tv_sec - w->silence_timer.tv_sec;
|
timer_difference = timer.tv_sec - w->silence_timer.tv_sec;
|
||||||
if (timer_difference <= silence_interval)
|
if (timer_difference <= silence_interval)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
if (options_get_number(&s->options, "bell-on-alert"))
|
||||||
|
ring_bell(s);
|
||||||
wl->flags |= WINLINK_SILENCE;
|
wl->flags |= WINLINK_SILENCE;
|
||||||
|
|
||||||
if (options_get_number(&s->options, "visual-silence")) {
|
if (options_get_number(&s->options, "visual-silence")) {
|
||||||
@ -221,6 +227,8 @@ server_window_check_content(
|
|||||||
return (0);
|
return (0);
|
||||||
xfree(found);
|
xfree(found);
|
||||||
|
|
||||||
|
if (options_get_number(&s->options, "bell-on-alert"))
|
||||||
|
ring_bell(s);
|
||||||
wl->flags |= WINLINK_CONTENT;
|
wl->flags |= WINLINK_CONTENT;
|
||||||
|
|
||||||
if (options_get_number(&s->options, "visual-content")) {
|
if (options_get_number(&s->options, "visual-content")) {
|
||||||
@ -235,3 +243,17 @@ server_window_check_content(
|
|||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ring terminal bell. */
|
||||||
|
void
|
||||||
|
ring_bell(struct session *s)
|
||||||
|
{
|
||||||
|
struct client *c;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||||
|
c = ARRAY_ITEM(&clients, i);
|
||||||
|
if (c != NULL && c->session == s)
|
||||||
|
tty_putcode(&c->tty, TTYC_BEL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
5
tmux.1
5
tmux.1
@ -1783,6 +1783,11 @@ window of that session,
|
|||||||
means all bells are ignored and
|
means all bells are ignored and
|
||||||
.Ic current
|
.Ic current
|
||||||
means only bell in windows other than the current window are ignored.
|
means only bell in windows other than the current window are ignored.
|
||||||
|
.It Xo Ic bell-on-alert
|
||||||
|
.Op Ic on | off
|
||||||
|
.Xc
|
||||||
|
If on, ring the terminal bell when an activity, content or silence alert
|
||||||
|
occurs.
|
||||||
.It Ic default-command Ar shell-command
|
.It Ic default-command Ar shell-command
|
||||||
Set the command used for new windows (if not specified when the window is
|
Set the command used for new windows (if not specified when the window is
|
||||||
created) to
|
created) to
|
||||||
|
Loading…
Reference in New Issue
Block a user